Repository: 56kcloud/Training
Branch: main
Commit: 8848b8430ccb
Files: 2190
Total size: 57.6 MB
Directory structure:
gitextract_zw7rzu5x/
├── .gitmodules
├── CNAME
├── Cloud/
│ └── README.md
├── DevOps/
│ └── README.md
├── DevOpsDays/
│ └── readme.md
├── Docker/
│ ├── 12factor/
│ │ ├── 00_application.md
│ │ ├── 01_codebase.md
│ │ ├── 02_dependencies.md
│ │ ├── 03_configuration.md
│ │ ├── 04_external_services.md
│ │ ├── 05_build_release_run.md
│ │ ├── 06_processes.md
│ │ ├── 07_port_binding.md
│ │ ├── 08_concurrency.md
│ │ ├── 09_disposability.md
│ │ ├── 10_dev_prod_parity.md
│ │ ├── 11_logs.md
│ │ ├── 12_admin_processes.md
│ │ └── README.md
│ ├── Docker-Orchestration/
│ │ └── readme.md
│ ├── README.md
│ ├── additional-ressources/
│ │ ├── README.md
│ │ ├── developer-tools/
│ │ │ ├── README.md
│ │ │ ├── README_es.md
│ │ │ ├── java/
│ │ │ │ ├── chapters/
│ │ │ │ │ ├── appa-common-commands.adoc
│ │ │ │ │ ├── appb-troubleshooting.adoc
│ │ │ │ │ ├── appc-references.adoc
│ │ │ │ │ ├── ch01-setup.adoc
│ │ │ │ │ ├── ch02-basic-concepts.adoc
│ │ │ │ │ ├── ch03-build-image-java-9.adoc
│ │ │ │ │ ├── ch03-build-image.adoc
│ │ │ │ │ ├── ch04-run-container.adoc
│ │ │ │ │ ├── ch05-compose.adoc
│ │ │ │ │ ├── ch06-swarm.adoc
│ │ │ │ │ ├── ch07-eclipse.adoc
│ │ │ │ │ ├── ch07-intellij.adoc
│ │ │ │ │ ├── ch07-netbeans.adoc
│ │ │ │ │ ├── ch08-aws.adoc
│ │ │ │ │ ├── ch08-azure.adoc
│ │ │ │ │ ├── ch08-cloud.adoc
│ │ │ │ │ ├── ch09-cicd.adoc
│ │ │ │ │ ├── ch10-monitoring.adoc
│ │ │ │ │ └── ch11-bigdata.adoc
│ │ │ │ ├── readme.adoc
│ │ │ │ └── scripts/
│ │ │ │ └── docker-compose-pull-images.yml
│ │ │ ├── java-debugging/
│ │ │ │ ├── Eclipse-README.md
│ │ │ │ ├── Eclipse-README_es.md
│ │ │ │ ├── IntelliJ-README.md
│ │ │ │ ├── IntelliJ-README_es.md
│ │ │ │ ├── NetBeans-README.md
│ │ │ │ ├── NetBeans-README_es.md
│ │ │ │ ├── README.md
│ │ │ │ ├── README_es.md
│ │ │ │ ├── app/
│ │ │ │ │ ├── .gitignore
│ │ │ │ │ ├── pom.xml
│ │ │ │ │ └── src/
│ │ │ │ │ └── main/
│ │ │ │ │ ├── java/
│ │ │ │ │ │ └── com/
│ │ │ │ │ │ └── docker/
│ │ │ │ │ │ └── UserSignup/
│ │ │ │ │ │ ├── controller/
│ │ │ │ │ │ │ └── UserController.java
│ │ │ │ │ │ ├── model/
│ │ │ │ │ │ │ ├── User.java
│ │ │ │ │ │ │ └── UserLogin.java
│ │ │ │ │ │ ├── repository/
│ │ │ │ │ │ │ └── UserRepository.java
│ │ │ │ │ │ ├── service/
│ │ │ │ │ │ │ ├── UserService.java
│ │ │ │ │ │ │ └── UserServiceImpl.java
│ │ │ │ │ │ └── util/
│ │ │ │ │ │ └── Rot13.java
│ │ │ │ │ ├── resources/
│ │ │ │ │ │ ├── META-INF/
│ │ │ │ │ │ │ └── persistence.xml
│ │ │ │ │ │ ├── jpaContext.xml
│ │ │ │ │ │ └── messages.properties
│ │ │ │ │ └── webapp/
│ │ │ │ │ ├── WEB-INF/
│ │ │ │ │ │ ├── config/
│ │ │ │ │ │ │ └── servletConfig.xml
│ │ │ │ │ │ ├── jsp/
│ │ │ │ │ │ │ ├── failure.jsp
│ │ │ │ │ │ │ ├── login.jsp
│ │ │ │ │ │ │ ├── signup.jsp
│ │ │ │ │ │ │ └── success.jsp
│ │ │ │ │ │ └── web.xml
│ │ │ │ │ ├── assets/
│ │ │ │ │ │ └── css/
│ │ │ │ │ │ └── bootstrap-united.css
│ │ │ │ │ ├── bootstrap/
│ │ │ │ │ │ ├── css/
│ │ │ │ │ │ │ ├── bootstrap-theme.css
│ │ │ │ │ │ │ └── bootstrap.css
│ │ │ │ │ │ └── js/
│ │ │ │ │ │ └── bootstrap.js
│ │ │ │ │ ├── datepicker/
│ │ │ │ │ │ ├── css/
│ │ │ │ │ │ │ └── datepicker.css
│ │ │ │ │ │ ├── js/
│ │ │ │ │ │ │ └── bootstrap-datepicker.js
│ │ │ │ │ │ └── less/
│ │ │ │ │ │ └── datepicker.less
│ │ │ │ │ ├── index.jsp
│ │ │ │ │ └── jquery-1.8.3.js
│ │ │ │ ├── docker-compose.yml
│ │ │ │ ├── images/
│ │ │ │ │ └── resizeImg.py
│ │ │ │ ├── registration-database/
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ ├── README.md
│ │ │ │ │ └── docker-entrypoint-initdb.d/
│ │ │ │ │ └── initialize_db.sql
│ │ │ │ └── registration-webserver/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── README.md
│ │ │ │ └── tomcat/
│ │ │ │ ├── mysql-connector-java-5.1.36-bin.jar
│ │ │ │ ├── run.sh
│ │ │ │ └── tomcat-users.xml
│ │ │ ├── nodejs/
│ │ │ │ └── porting/
│ │ │ │ ├── 1_node_application.md
│ │ │ │ ├── 2_application_image.md
│ │ │ │ ├── 3_publish_image.md
│ │ │ │ ├── 4_single_host_networking.md
│ │ │ │ ├── 5_multiple_hosts_networking.md
│ │ │ │ ├── 6_deploy_on_swarm.md
│ │ │ │ ├── README.md
│ │ │ │ └── summary.md
│ │ │ ├── nodejs-debugging/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── README.md
│ │ │ │ ├── VSCode-README.md
│ │ │ │ └── app/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── app.js
│ │ │ │ ├── docker-compose.yml
│ │ │ │ ├── index.html
│ │ │ │ ├── layouts/
│ │ │ │ │ └── main.handlebars
│ │ │ │ └── package.json
│ │ │ └── ruby/
│ │ │ └── README.md
│ │ ├── dockercon-us-2017/
│ │ │ ├── README.md
│ │ │ ├── docker-cloud/
│ │ │ │ └── README.md
│ │ │ ├── docker-enterprise/
│ │ │ │ └── README.md
│ │ │ ├── docker-networking/
│ │ │ │ └── README.md
│ │ │ ├── docker-orchestration/
│ │ │ │ └── README.md
│ │ │ ├── securing-apps-docker-enterprise/
│ │ │ │ └── README.md
│ │ │ ├── template.md
│ │ │ ├── windows-101/
│ │ │ │ ├── README.md
│ │ │ │ └── tweet-app/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── index.html
│ │ │ │ └── start.ps1
│ │ │ ├── windows-modernize-aspnet-dev/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── README.md
│ │ │ │ ├── v1-src/
│ │ │ │ │ ├── ProductLaunch/
│ │ │ │ │ │ ├── ProductLaunch.Core/
│ │ │ │ │ │ │ ├── Env.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Core.csproj
│ │ │ │ │ │ │ └── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── ProductLaunch.EndToEndTests/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.EndToEndTests.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── ProspectSignUp.feature
│ │ │ │ │ │ │ ├── ProspectSignUp.feature.cs
│ │ │ │ │ │ │ ├── ProspectSignUpSteps.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Entities/
│ │ │ │ │ │ │ ├── Country.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Entities.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── Prospect.cs
│ │ │ │ │ │ │ └── Role.cs
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── Documents/
│ │ │ │ │ │ │ │ └── Prospect.cs
│ │ │ │ │ │ │ ├── Indexer/
│ │ │ │ │ │ │ │ └── Index.cs
│ │ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect.csproj
│ │ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect.csproj
│ │ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Messaging/
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── MessageHelper.cs
│ │ │ │ │ │ │ ├── MessageQueue.cs
│ │ │ │ │ │ │ ├── Messages/
│ │ │ │ │ │ │ │ ├── Events/
│ │ │ │ │ │ │ │ │ └── ProspectSignedUpEvent.cs
│ │ │ │ │ │ │ │ └── Message.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Messaging.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Model/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── Initializers/
│ │ │ │ │ │ │ │ └── StaticDataInitializer.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Model.csproj
│ │ │ │ │ │ │ ├── ProductLaunchContext.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Model.Tests/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.Model.Tests.csproj
│ │ │ │ │ │ │ ├── ProductLaunchContextTest.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Web/
│ │ │ │ │ │ │ ├── About.aspx
│ │ │ │ │ │ │ ├── About.aspx.cs
│ │ │ │ │ │ │ ├── About.aspx.designer.cs
│ │ │ │ │ │ │ ├── App_Start/
│ │ │ │ │ │ │ │ ├── BundleConfig.cs
│ │ │ │ │ │ │ │ └── RouteConfig.cs
│ │ │ │ │ │ │ ├── ApplicationInsights.config
│ │ │ │ │ │ │ ├── Bundle.config
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── Contact.aspx
│ │ │ │ │ │ │ ├── Contact.aspx.cs
│ │ │ │ │ │ │ ├── Contact.aspx.designer.cs
│ │ │ │ │ │ │ ├── Content/
│ │ │ │ │ │ │ │ ├── Site.css
│ │ │ │ │ │ │ │ └── bootstrap.css
│ │ │ │ │ │ │ ├── Default.aspx
│ │ │ │ │ │ │ ├── Default.aspx.cs
│ │ │ │ │ │ │ ├── Default.aspx.designer.cs
│ │ │ │ │ │ │ ├── Global.asax
│ │ │ │ │ │ │ ├── Global.asax.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Web.csproj
│ │ │ │ │ │ │ ├── Project_Readme.html
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── Scripts/
│ │ │ │ │ │ │ │ ├── WebForms/
│ │ │ │ │ │ │ │ │ ├── DetailsView.js
│ │ │ │ │ │ │ │ │ ├── Focus.js
│ │ │ │ │ │ │ │ │ ├── GridView.js
│ │ │ │ │ │ │ │ │ ├── MSAjax/
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjax.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxApplicationServices.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxComponentModel.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxCore.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxGlobalization.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxHistory.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxNetwork.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxSerialization.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxTimer.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxWebForms.js
│ │ │ │ │ │ │ │ │ │ └── MicrosoftAjaxWebServices.js
│ │ │ │ │ │ │ │ │ ├── Menu.js
│ │ │ │ │ │ │ │ │ ├── MenuStandards.js
│ │ │ │ │ │ │ │ │ ├── SmartNav.js
│ │ │ │ │ │ │ │ │ ├── TreeView.js
│ │ │ │ │ │ │ │ │ ├── WebForms.js
│ │ │ │ │ │ │ │ │ ├── WebParts.js
│ │ │ │ │ │ │ │ │ └── WebUIValidation.js
│ │ │ │ │ │ │ │ ├── _references.js
│ │ │ │ │ │ │ │ ├── bootstrap.js
│ │ │ │ │ │ │ │ ├── jquery-1.10.2.intellisense.js
│ │ │ │ │ │ │ │ ├── jquery-1.10.2.js
│ │ │ │ │ │ │ │ ├── modernizr-2.6.2.js
│ │ │ │ │ │ │ │ └── respond.js
│ │ │ │ │ │ │ ├── SignUp.aspx
│ │ │ │ │ │ │ ├── SignUp.aspx.cs
│ │ │ │ │ │ │ ├── SignUp.aspx.designer.cs
│ │ │ │ │ │ │ ├── Site.Master
│ │ │ │ │ │ │ ├── Site.Master.cs
│ │ │ │ │ │ │ ├── Site.Master.designer.cs
│ │ │ │ │ │ │ ├── Site.Mobile.Master
│ │ │ │ │ │ │ ├── Site.Mobile.Master.cs
│ │ │ │ │ │ │ ├── Site.Mobile.Master.designer.cs
│ │ │ │ │ │ │ ├── ThankYou.aspx
│ │ │ │ │ │ │ ├── ThankYou.aspx.cs
│ │ │ │ │ │ │ ├── ThankYou.aspx.designer.cs
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx.cs
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx.designer.cs
│ │ │ │ │ │ │ ├── Web.Debug.config
│ │ │ │ │ │ │ ├── Web.Release.config
│ │ │ │ │ │ │ ├── Web.config
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.sln
│ │ │ │ │ │ └── build.ps1
│ │ │ │ │ ├── build.ps1
│ │ │ │ │ └── docker/
│ │ │ │ │ ├── builder/
│ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ └── web/
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ └── Web.config
│ │ │ │ └── v2-src/
│ │ │ │ ├── ProductLaunch/
│ │ │ │ │ ├── ProductLaunch.Core/
│ │ │ │ │ │ ├── Env.cs
│ │ │ │ │ │ ├── ProductLaunch.Core.csproj
│ │ │ │ │ │ └── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── ProductLaunch.EndToEndTests/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── ProductLaunch.EndToEndTests.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── ProspectSignUp.feature
│ │ │ │ │ │ ├── ProspectSignUp.feature.cs
│ │ │ │ │ │ ├── ProspectSignUpSteps.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Entities/
│ │ │ │ │ │ ├── Country.cs
│ │ │ │ │ │ ├── ProductLaunch.Entities.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── Prospect.cs
│ │ │ │ │ │ └── Role.cs
│ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── Documents/
│ │ │ │ │ │ │ └── Prospect.cs
│ │ │ │ │ │ ├── Indexer/
│ │ │ │ │ │ │ └── Index.cs
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect.csproj
│ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect.csproj
│ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Messaging/
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── MessageHelper.cs
│ │ │ │ │ │ ├── MessageQueue.cs
│ │ │ │ │ │ ├── Messages/
│ │ │ │ │ │ │ ├── Events/
│ │ │ │ │ │ │ │ └── ProspectSignedUpEvent.cs
│ │ │ │ │ │ │ └── Message.cs
│ │ │ │ │ │ ├── ProductLaunch.Messaging.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Model/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── Initializers/
│ │ │ │ │ │ │ └── StaticDataInitializer.cs
│ │ │ │ │ │ ├── ProductLaunch.Model.csproj
│ │ │ │ │ │ ├── ProductLaunchContext.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Model.Tests/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── ProductLaunch.Model.Tests.csproj
│ │ │ │ │ │ ├── ProductLaunchContextTest.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Web/
│ │ │ │ │ │ ├── About.aspx
│ │ │ │ │ │ ├── About.aspx.cs
│ │ │ │ │ │ ├── About.aspx.designer.cs
│ │ │ │ │ │ ├── App_Start/
│ │ │ │ │ │ │ ├── BundleConfig.cs
│ │ │ │ │ │ │ └── RouteConfig.cs
│ │ │ │ │ │ ├── ApplicationInsights.config
│ │ │ │ │ │ ├── Bundle.config
│ │ │ │ │ │ ├── Contact.aspx
│ │ │ │ │ │ ├── Contact.aspx.cs
│ │ │ │ │ │ ├── Contact.aspx.designer.cs
│ │ │ │ │ │ ├── Content/
│ │ │ │ │ │ │ ├── Site.css
│ │ │ │ │ │ │ └── bootstrap.css
│ │ │ │ │ │ ├── Default.aspx
│ │ │ │ │ │ ├── Default.aspx.cs
│ │ │ │ │ │ ├── Default.aspx.designer.cs
│ │ │ │ │ │ ├── Global.asax
│ │ │ │ │ │ ├── Global.asax.cs
│ │ │ │ │ │ ├── ProductLaunch.Web.csproj
│ │ │ │ │ │ ├── Project_Readme.html
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── Scripts/
│ │ │ │ │ │ │ ├── WebForms/
│ │ │ │ │ │ │ │ ├── DetailsView.js
│ │ │ │ │ │ │ │ ├── Focus.js
│ │ │ │ │ │ │ │ ├── GridView.js
│ │ │ │ │ │ │ │ ├── MSAjax/
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjax.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxApplicationServices.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxComponentModel.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxCore.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxGlobalization.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxHistory.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxNetwork.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxSerialization.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxTimer.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxWebForms.js
│ │ │ │ │ │ │ │ │ └── MicrosoftAjaxWebServices.js
│ │ │ │ │ │ │ │ ├── Menu.js
│ │ │ │ │ │ │ │ ├── MenuStandards.js
│ │ │ │ │ │ │ │ ├── SmartNav.js
│ │ │ │ │ │ │ │ ├── TreeView.js
│ │ │ │ │ │ │ │ ├── WebForms.js
│ │ │ │ │ │ │ │ ├── WebParts.js
│ │ │ │ │ │ │ │ └── WebUIValidation.js
│ │ │ │ │ │ │ ├── _references.js
│ │ │ │ │ │ │ ├── bootstrap.js
│ │ │ │ │ │ │ ├── jquery-1.10.2.intellisense.js
│ │ │ │ │ │ │ ├── jquery-1.10.2.js
│ │ │ │ │ │ │ ├── modernizr-2.6.2.js
│ │ │ │ │ │ │ └── respond.js
│ │ │ │ │ │ ├── SignUp.aspx
│ │ │ │ │ │ ├── SignUp.aspx.cs
│ │ │ │ │ │ ├── SignUp.aspx.designer.cs
│ │ │ │ │ │ ├── Site.Master
│ │ │ │ │ │ ├── Site.Master.cs
│ │ │ │ │ │ ├── Site.Master.designer.cs
│ │ │ │ │ │ ├── Site.Mobile.Master
│ │ │ │ │ │ ├── Site.Mobile.Master.cs
│ │ │ │ │ │ ├── Site.Mobile.Master.designer.cs
│ │ │ │ │ │ ├── ThankYou.aspx
│ │ │ │ │ │ ├── ThankYou.aspx.cs
│ │ │ │ │ │ ├── ThankYou.aspx.designer.cs
│ │ │ │ │ │ ├── ViewSwitcher.ascx
│ │ │ │ │ │ ├── ViewSwitcher.ascx.cs
│ │ │ │ │ │ ├── ViewSwitcher.ascx.designer.cs
│ │ │ │ │ │ ├── Web.Debug.config
│ │ │ │ │ │ ├── Web.Release.config
│ │ │ │ │ │ ├── Web.config
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.sln
│ │ │ │ │ └── build.ps1
│ │ │ │ ├── build.ps1
│ │ │ │ ├── docker/
│ │ │ │ │ ├── builder/
│ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ ├── save-prospect/
│ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ └── web/
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ └── bootstrap.ps1
│ │ │ │ └── docker-compose.yml
│ │ │ ├── windows-modernize-aspnet-ops/
│ │ │ │ ├── README.md
│ │ │ │ ├── v1.0/
│ │ │ │ │ └── Dockerfile
│ │ │ │ └── v1.1/
│ │ │ │ └── Dockerfile
│ │ │ └── workshop-slides/
│ │ │ └── README.md
│ │ ├── slides/
│ │ │ ├── docker-introduction.key
│ │ │ └── docker-java-dockercon-2017.key
│ │ └── windows/
│ │ ├── .gitattributes
│ │ ├── .gitignore
│ │ ├── aspnet-web/
│ │ │ ├── README.md
│ │ │ ├── docker-compose.yml
│ │ │ └── webserver/
│ │ │ ├── Dockerfile
│ │ │ └── app/
│ │ │ ├── Program.cs
│ │ │ ├── Startup.cs
│ │ │ ├── project.json
│ │ │ └── run.bat
│ │ ├── modernize-traditional-apps/
│ │ │ ├── README.md
│ │ │ ├── modernize-aspnet/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── README.md
│ │ │ │ ├── part-1.md
│ │ │ │ ├── part-2.md
│ │ │ │ ├── part-3.md
│ │ │ │ ├── part-4.md
│ │ │ │ ├── part-5.md
│ │ │ │ ├── v1-src/
│ │ │ │ │ ├── ProductLaunch/
│ │ │ │ │ │ ├── ProductLaunch.Core/
│ │ │ │ │ │ │ ├── Env.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Core.csproj
│ │ │ │ │ │ │ └── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── ProductLaunch.EndToEndTests/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.EndToEndTests.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── ProspectSignUp.feature
│ │ │ │ │ │ │ ├── ProspectSignUp.feature.cs
│ │ │ │ │ │ │ ├── ProspectSignUpSteps.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Entities/
│ │ │ │ │ │ │ ├── Country.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Entities.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── Prospect.cs
│ │ │ │ │ │ │ └── Role.cs
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── Documents/
│ │ │ │ │ │ │ │ └── Prospect.cs
│ │ │ │ │ │ │ ├── Indexer/
│ │ │ │ │ │ │ │ └── Index.cs
│ │ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect.csproj
│ │ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect.csproj
│ │ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Messaging/
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── MessageHelper.cs
│ │ │ │ │ │ │ ├── MessageQueue.cs
│ │ │ │ │ │ │ ├── Messages/
│ │ │ │ │ │ │ │ ├── Events/
│ │ │ │ │ │ │ │ │ └── ProspectSignedUpEvent.cs
│ │ │ │ │ │ │ │ └── Message.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Messaging.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Model/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── Initializers/
│ │ │ │ │ │ │ │ └── StaticDataInitializer.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Model.csproj
│ │ │ │ │ │ │ ├── ProductLaunchContext.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Model.Tests/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.Model.Tests.csproj
│ │ │ │ │ │ │ ├── ProductLaunchContextTest.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Web/
│ │ │ │ │ │ │ ├── About.aspx
│ │ │ │ │ │ │ ├── About.aspx.cs
│ │ │ │ │ │ │ ├── About.aspx.designer.cs
│ │ │ │ │ │ │ ├── App_Start/
│ │ │ │ │ │ │ │ ├── BundleConfig.cs
│ │ │ │ │ │ │ │ └── RouteConfig.cs
│ │ │ │ │ │ │ ├── ApplicationInsights.config
│ │ │ │ │ │ │ ├── Bundle.config
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── Contact.aspx
│ │ │ │ │ │ │ ├── Contact.aspx.cs
│ │ │ │ │ │ │ ├── Contact.aspx.designer.cs
│ │ │ │ │ │ │ ├── Content/
│ │ │ │ │ │ │ │ ├── Site.css
│ │ │ │ │ │ │ │ └── bootstrap.css
│ │ │ │ │ │ │ ├── Default.aspx
│ │ │ │ │ │ │ ├── Default.aspx.cs
│ │ │ │ │ │ │ ├── Default.aspx.designer.cs
│ │ │ │ │ │ │ ├── Global.asax
│ │ │ │ │ │ │ ├── Global.asax.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Web.csproj
│ │ │ │ │ │ │ ├── Project_Readme.html
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── Scripts/
│ │ │ │ │ │ │ │ ├── WebForms/
│ │ │ │ │ │ │ │ │ ├── DetailsView.js
│ │ │ │ │ │ │ │ │ ├── Focus.js
│ │ │ │ │ │ │ │ │ ├── GridView.js
│ │ │ │ │ │ │ │ │ ├── MSAjax/
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjax.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxApplicationServices.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxComponentModel.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxCore.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxGlobalization.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxHistory.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxNetwork.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxSerialization.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxTimer.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxWebForms.js
│ │ │ │ │ │ │ │ │ │ └── MicrosoftAjaxWebServices.js
│ │ │ │ │ │ │ │ │ ├── Menu.js
│ │ │ │ │ │ │ │ │ ├── MenuStandards.js
│ │ │ │ │ │ │ │ │ ├── SmartNav.js
│ │ │ │ │ │ │ │ │ ├── TreeView.js
│ │ │ │ │ │ │ │ │ ├── WebForms.js
│ │ │ │ │ │ │ │ │ ├── WebParts.js
│ │ │ │ │ │ │ │ │ └── WebUIValidation.js
│ │ │ │ │ │ │ │ ├── _references.js
│ │ │ │ │ │ │ │ ├── bootstrap.js
│ │ │ │ │ │ │ │ ├── jquery-1.10.2.intellisense.js
│ │ │ │ │ │ │ │ ├── jquery-1.10.2.js
│ │ │ │ │ │ │ │ ├── modernizr-2.6.2.js
│ │ │ │ │ │ │ │ └── respond.js
│ │ │ │ │ │ │ ├── SignUp.aspx
│ │ │ │ │ │ │ ├── SignUp.aspx.cs
│ │ │ │ │ │ │ ├── SignUp.aspx.designer.cs
│ │ │ │ │ │ │ ├── Site.Master
│ │ │ │ │ │ │ ├── Site.Master.cs
│ │ │ │ │ │ │ ├── Site.Master.designer.cs
│ │ │ │ │ │ │ ├── Site.Mobile.Master
│ │ │ │ │ │ │ ├── Site.Mobile.Master.cs
│ │ │ │ │ │ │ ├── Site.Mobile.Master.designer.cs
│ │ │ │ │ │ │ ├── ThankYou.aspx
│ │ │ │ │ │ │ ├── ThankYou.aspx.cs
│ │ │ │ │ │ │ ├── ThankYou.aspx.designer.cs
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx.cs
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx.designer.cs
│ │ │ │ │ │ │ ├── Web.Debug.config
│ │ │ │ │ │ │ ├── Web.Release.config
│ │ │ │ │ │ │ ├── Web.config
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.sln
│ │ │ │ │ │ └── build.ps1
│ │ │ │ │ ├── build.ps1
│ │ │ │ │ └── docker/
│ │ │ │ │ ├── builder/
│ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ └── web/
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ └── Web.config
│ │ │ │ ├── v2-src/
│ │ │ │ │ ├── ProductLaunch/
│ │ │ │ │ │ ├── ProductLaunch.Core/
│ │ │ │ │ │ │ ├── Env.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Core.csproj
│ │ │ │ │ │ │ └── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── ProductLaunch.EndToEndTests/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.EndToEndTests.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── ProspectSignUp.feature
│ │ │ │ │ │ │ ├── ProspectSignUp.feature.cs
│ │ │ │ │ │ │ ├── ProspectSignUpSteps.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Entities/
│ │ │ │ │ │ │ ├── Country.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Entities.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── Prospect.cs
│ │ │ │ │ │ │ └── Role.cs
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── Documents/
│ │ │ │ │ │ │ │ └── Prospect.cs
│ │ │ │ │ │ │ ├── Indexer/
│ │ │ │ │ │ │ │ └── Index.cs
│ │ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect.csproj
│ │ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect.csproj
│ │ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Messaging/
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── MessageHelper.cs
│ │ │ │ │ │ │ ├── MessageQueue.cs
│ │ │ │ │ │ │ ├── Messages/
│ │ │ │ │ │ │ │ ├── Events/
│ │ │ │ │ │ │ │ │ └── ProspectSignedUpEvent.cs
│ │ │ │ │ │ │ │ └── Message.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Messaging.csproj
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Model/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ │ ├── Initializers/
│ │ │ │ │ │ │ │ └── StaticDataInitializer.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Model.csproj
│ │ │ │ │ │ │ ├── ProductLaunchContext.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Model.Tests/
│ │ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ │ ├── ProductLaunch.Model.Tests.csproj
│ │ │ │ │ │ │ ├── ProductLaunchContextTest.cs
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.Web/
│ │ │ │ │ │ │ ├── About.aspx
│ │ │ │ │ │ │ ├── About.aspx.cs
│ │ │ │ │ │ │ ├── About.aspx.designer.cs
│ │ │ │ │ │ │ ├── App_Start/
│ │ │ │ │ │ │ │ ├── BundleConfig.cs
│ │ │ │ │ │ │ │ └── RouteConfig.cs
│ │ │ │ │ │ │ ├── ApplicationInsights.config
│ │ │ │ │ │ │ ├── Bundle.config
│ │ │ │ │ │ │ ├── Contact.aspx
│ │ │ │ │ │ │ ├── Contact.aspx.cs
│ │ │ │ │ │ │ ├── Contact.aspx.designer.cs
│ │ │ │ │ │ │ ├── Content/
│ │ │ │ │ │ │ │ ├── Site.css
│ │ │ │ │ │ │ │ └── bootstrap.css
│ │ │ │ │ │ │ ├── Default.aspx
│ │ │ │ │ │ │ ├── Default.aspx.cs
│ │ │ │ │ │ │ ├── Default.aspx.designer.cs
│ │ │ │ │ │ │ ├── Global.asax
│ │ │ │ │ │ │ ├── Global.asax.cs
│ │ │ │ │ │ │ ├── ProductLaunch.Web.csproj
│ │ │ │ │ │ │ ├── Project_Readme.html
│ │ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ │ ├── Scripts/
│ │ │ │ │ │ │ │ ├── WebForms/
│ │ │ │ │ │ │ │ │ ├── DetailsView.js
│ │ │ │ │ │ │ │ │ ├── Focus.js
│ │ │ │ │ │ │ │ │ ├── GridView.js
│ │ │ │ │ │ │ │ │ ├── MSAjax/
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjax.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxApplicationServices.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxComponentModel.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxCore.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxGlobalization.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxHistory.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxNetwork.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxSerialization.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxTimer.js
│ │ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxWebForms.js
│ │ │ │ │ │ │ │ │ │ └── MicrosoftAjaxWebServices.js
│ │ │ │ │ │ │ │ │ ├── Menu.js
│ │ │ │ │ │ │ │ │ ├── MenuStandards.js
│ │ │ │ │ │ │ │ │ ├── SmartNav.js
│ │ │ │ │ │ │ │ │ ├── TreeView.js
│ │ │ │ │ │ │ │ │ ├── WebForms.js
│ │ │ │ │ │ │ │ │ ├── WebParts.js
│ │ │ │ │ │ │ │ │ └── WebUIValidation.js
│ │ │ │ │ │ │ │ ├── _references.js
│ │ │ │ │ │ │ │ ├── bootstrap.js
│ │ │ │ │ │ │ │ ├── jquery-1.10.2.intellisense.js
│ │ │ │ │ │ │ │ ├── jquery-1.10.2.js
│ │ │ │ │ │ │ │ ├── modernizr-2.6.2.js
│ │ │ │ │ │ │ │ └── respond.js
│ │ │ │ │ │ │ ├── SignUp.aspx
│ │ │ │ │ │ │ ├── SignUp.aspx.cs
│ │ │ │ │ │ │ ├── SignUp.aspx.designer.cs
│ │ │ │ │ │ │ ├── Site.Master
│ │ │ │ │ │ │ ├── Site.Master.cs
│ │ │ │ │ │ │ ├── Site.Master.designer.cs
│ │ │ │ │ │ │ ├── Site.Mobile.Master
│ │ │ │ │ │ │ ├── Site.Mobile.Master.cs
│ │ │ │ │ │ │ ├── Site.Mobile.Master.designer.cs
│ │ │ │ │ │ │ ├── ThankYou.aspx
│ │ │ │ │ │ │ ├── ThankYou.aspx.cs
│ │ │ │ │ │ │ ├── ThankYou.aspx.designer.cs
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx.cs
│ │ │ │ │ │ │ ├── ViewSwitcher.ascx.designer.cs
│ │ │ │ │ │ │ ├── Web.Debug.config
│ │ │ │ │ │ │ ├── Web.Release.config
│ │ │ │ │ │ │ ├── Web.config
│ │ │ │ │ │ │ └── packages.config
│ │ │ │ │ │ ├── ProductLaunch.sln
│ │ │ │ │ │ └── build.ps1
│ │ │ │ │ ├── build.ps1
│ │ │ │ │ ├── docker/
│ │ │ │ │ │ ├── builder/
│ │ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ │ ├── save-prospect/
│ │ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ │ └── web/
│ │ │ │ │ │ ├── Dockerfile
│ │ │ │ │ │ └── bootstrap.ps1
│ │ │ │ │ └── docker-compose.yml
│ │ │ │ └── v3-src/
│ │ │ │ ├── ProductLaunch/
│ │ │ │ │ ├── ProductLaunch.Core/
│ │ │ │ │ │ ├── Env.cs
│ │ │ │ │ │ ├── ProductLaunch.Core.csproj
│ │ │ │ │ │ └── Properties/
│ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ ├── ProductLaunch.EndToEndTests/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── ProductLaunch.EndToEndTests.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── ProspectSignUp.feature
│ │ │ │ │ │ ├── ProspectSignUp.feature.cs
│ │ │ │ │ │ ├── ProspectSignUpSteps.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Entities/
│ │ │ │ │ │ ├── Country.cs
│ │ │ │ │ │ ├── ProductLaunch.Entities.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── Prospect.cs
│ │ │ │ │ │ └── Role.cs
│ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── Documents/
│ │ │ │ │ │ │ └── Prospect.cs
│ │ │ │ │ │ ├── Indexer/
│ │ │ │ │ │ │ └── Index.cs
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.IndexProspect.csproj
│ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── ProductLaunch.MessageHandlers.SaveProspect.csproj
│ │ │ │ │ │ ├── Program.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Messaging/
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── MessageHelper.cs
│ │ │ │ │ │ ├── MessageQueue.cs
│ │ │ │ │ │ ├── Messages/
│ │ │ │ │ │ │ ├── Events/
│ │ │ │ │ │ │ │ └── ProspectSignedUpEvent.cs
│ │ │ │ │ │ │ └── Message.cs
│ │ │ │ │ │ ├── ProductLaunch.Messaging.csproj
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Model/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── Initializers/
│ │ │ │ │ │ │ └── StaticDataInitializer.cs
│ │ │ │ │ │ ├── ProductLaunch.Model.csproj
│ │ │ │ │ │ ├── ProductLaunchContext.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Model.Tests/
│ │ │ │ │ │ ├── App.config
│ │ │ │ │ │ ├── ProductLaunch.Model.Tests.csproj
│ │ │ │ │ │ ├── ProductLaunchContextTest.cs
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.Web/
│ │ │ │ │ │ ├── About.aspx
│ │ │ │ │ │ ├── About.aspx.cs
│ │ │ │ │ │ ├── About.aspx.designer.cs
│ │ │ │ │ │ ├── App_Start/
│ │ │ │ │ │ │ ├── BundleConfig.cs
│ │ │ │ │ │ │ └── RouteConfig.cs
│ │ │ │ │ │ ├── ApplicationInsights.config
│ │ │ │ │ │ ├── Bundle.config
│ │ │ │ │ │ ├── Config.cs
│ │ │ │ │ │ ├── Contact.aspx
│ │ │ │ │ │ ├── Contact.aspx.cs
│ │ │ │ │ │ ├── Contact.aspx.designer.cs
│ │ │ │ │ │ ├── Content/
│ │ │ │ │ │ │ ├── Site.css
│ │ │ │ │ │ │ └── bootstrap.css
│ │ │ │ │ │ ├── Default.aspx
│ │ │ │ │ │ ├── Default.aspx.cs
│ │ │ │ │ │ ├── Default.aspx.designer.cs
│ │ │ │ │ │ ├── Global.asax
│ │ │ │ │ │ ├── Global.asax.cs
│ │ │ │ │ │ ├── ProductLaunch.Web.csproj
│ │ │ │ │ │ ├── Project_Readme.html
│ │ │ │ │ │ ├── Properties/
│ │ │ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ │ │ ├── Scripts/
│ │ │ │ │ │ │ ├── WebForms/
│ │ │ │ │ │ │ │ ├── DetailsView.js
│ │ │ │ │ │ │ │ ├── Focus.js
│ │ │ │ │ │ │ │ ├── GridView.js
│ │ │ │ │ │ │ │ ├── MSAjax/
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjax.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxApplicationServices.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxComponentModel.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxCore.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxGlobalization.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxHistory.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxNetwork.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxSerialization.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxTimer.js
│ │ │ │ │ │ │ │ │ ├── MicrosoftAjaxWebForms.js
│ │ │ │ │ │ │ │ │ └── MicrosoftAjaxWebServices.js
│ │ │ │ │ │ │ │ ├── Menu.js
│ │ │ │ │ │ │ │ ├── MenuStandards.js
│ │ │ │ │ │ │ │ ├── SmartNav.js
│ │ │ │ │ │ │ │ ├── TreeView.js
│ │ │ │ │ │ │ │ ├── WebForms.js
│ │ │ │ │ │ │ │ ├── WebParts.js
│ │ │ │ │ │ │ │ └── WebUIValidation.js
│ │ │ │ │ │ │ ├── _references.js
│ │ │ │ │ │ │ ├── bootstrap.js
│ │ │ │ │ │ │ ├── jquery-1.10.2.intellisense.js
│ │ │ │ │ │ │ ├── jquery-1.10.2.js
│ │ │ │ │ │ │ ├── modernizr-2.6.2.js
│ │ │ │ │ │ │ └── respond.js
│ │ │ │ │ │ ├── SignUp.aspx
│ │ │ │ │ │ ├── SignUp.aspx.cs
│ │ │ │ │ │ ├── SignUp.aspx.designer.cs
│ │ │ │ │ │ ├── Site.Master
│ │ │ │ │ │ ├── Site.Master.cs
│ │ │ │ │ │ ├── Site.Master.designer.cs
│ │ │ │ │ │ ├── Site.Mobile.Master
│ │ │ │ │ │ ├── Site.Mobile.Master.cs
│ │ │ │ │ │ ├── Site.Mobile.Master.designer.cs
│ │ │ │ │ │ ├── ThankYou.aspx
│ │ │ │ │ │ ├── ThankYou.aspx.cs
│ │ │ │ │ │ ├── ThankYou.aspx.designer.cs
│ │ │ │ │ │ ├── ViewSwitcher.ascx
│ │ │ │ │ │ ├── ViewSwitcher.ascx.cs
│ │ │ │ │ │ ├── ViewSwitcher.ascx.designer.cs
│ │ │ │ │ │ ├── Web.Debug.config
│ │ │ │ │ │ ├── Web.Release.config
│ │ │ │ │ │ ├── Web.config
│ │ │ │ │ │ └── packages.config
│ │ │ │ │ ├── ProductLaunch.sln
│ │ │ │ │ └── build.ps1
│ │ │ │ ├── build.ps1
│ │ │ │ ├── docker/
│ │ │ │ │ ├── builder/
│ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ ├── docker-compose.yml
│ │ │ │ │ ├── homepage/
│ │ │ │ │ │ ├── Dockerfile
│ │ │ │ │ │ └── index.html
│ │ │ │ │ ├── save-prospect/
│ │ │ │ │ │ └── Dockerfile
│ │ │ │ │ └── web/
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ └── bootstrap.ps1
│ │ │ │ └── docker-compose.yml
│ │ │ └── modernize-aspnet-ops/
│ │ │ ├── .gitignore
│ │ │ ├── README.md
│ │ │ ├── part-1.md
│ │ │ ├── part-2.md
│ │ │ ├── part-3.md
│ │ │ ├── part-4.md
│ │ │ ├── v1.0/
│ │ │ │ ├── Dockerfile
│ │ │ │ └── build.ps1
│ │ │ ├── v1.1/
│ │ │ │ ├── Dockerfile
│ │ │ │ └── build.ps1
│ │ │ └── v1.2/
│ │ │ ├── build.ps1
│ │ │ ├── docker/
│ │ │ │ ├── builder/
│ │ │ │ │ └── Dockerfile
│ │ │ │ └── web/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── EnableIisRemoteManagement.ps1
│ │ │ │ └── UpgradeSample.Web/
│ │ │ │ ├── Default.aspx
│ │ │ │ ├── Global.asax
│ │ │ │ └── Web.config
│ │ │ └── src/
│ │ │ ├── UpgradeSample.Setup/
│ │ │ │ ├── Product.wxs
│ │ │ │ └── UpgradeSample.Setup.wixproj
│ │ │ ├── UpgradeSample.Web/
│ │ │ │ ├── Default.aspx
│ │ │ │ ├── Global.asax
│ │ │ │ ├── Global.asax.cs
│ │ │ │ ├── Properties/
│ │ │ │ │ └── AssemblyInfo.cs
│ │ │ │ ├── UpgradeSample.Web.csproj
│ │ │ │ ├── Web.Debug.config
│ │ │ │ ├── Web.Release.config
│ │ │ │ └── Web.config
│ │ │ ├── UpgradeSample.sln
│ │ │ ├── build.ps1
│ │ │ └── package-msi.ps1
│ │ ├── readme.md
│ │ ├── registry/
│ │ │ ├── Dockerfile
│ │ │ ├── Dockerfile.builder
│ │ │ ├── README.md
│ │ │ ├── part-1.md
│ │ │ ├── part-2.md
│ │ │ ├── part-3.md
│ │ │ └── part-4.md
│ │ ├── sql-server/
│ │ │ ├── .dockerignore
│ │ │ ├── .gitignore
│ │ │ ├── Dockerfile.builder
│ │ │ ├── Dockerfile.v1
│ │ │ ├── Dockerfile.v2
│ │ │ ├── Initialize-Database.ps1
│ │ │ ├── README.md
│ │ │ ├── assets.sql
│ │ │ ├── build.ps1
│ │ │ ├── part-1.md
│ │ │ ├── part-2.md
│ │ │ ├── part-3.md
│ │ │ ├── part-4.md
│ │ │ └── src/
│ │ │ ├── Assets.Database-v1/
│ │ │ │ ├── Assets.Database.refactorlog
│ │ │ │ ├── Assets.Database.sln
│ │ │ │ ├── Assets.Database.sqlproj
│ │ │ │ ├── Schema Objects/
│ │ │ │ │ ├── AssetTypes.sql
│ │ │ │ │ ├── Assets.sql
│ │ │ │ │ └── Locations.sql
│ │ │ │ └── Scripts/
│ │ │ │ ├── PostDeployment/
│ │ │ │ │ ├── InsertAssetTypes.sql
│ │ │ │ │ └── InsertLocations.sql
│ │ │ │ └── Script.PostDeployment.sql
│ │ │ └── Assets.Database-v2/
│ │ │ ├── Assets.Database.refactorlog
│ │ │ ├── Assets.Database.sln
│ │ │ ├── Assets.Database.sqlproj
│ │ │ ├── Schema Objects/
│ │ │ │ ├── AssetTypes.sql
│ │ │ │ ├── Assets.sql
│ │ │ │ ├── Locations.sql
│ │ │ │ └── Users.sql
│ │ │ └── Scripts/
│ │ │ ├── PostDeployment/
│ │ │ │ ├── InsertAssetTypes.sql
│ │ │ │ └── InsertLocations.sql
│ │ │ └── Script.PostDeployment.sql
│ │ └── windows-containers/
│ │ ├── MultiContainerApp.md
│ │ ├── README.md
│ │ ├── Setup-AWS.md
│ │ ├── Setup-Azure.md
│ │ ├── Setup-Server2016.md
│ │ ├── Setup-Win10.md
│ │ ├── Setup.md
│ │ └── WindowsContainers.md
│ ├── kickstart/
│ │ ├── chapters/
│ │ │ ├── alpine.md
│ │ │ ├── bridge-network.md
│ │ │ ├── devops.md
│ │ │ ├── docker-devpops.md
│ │ │ ├── images-and-volumes.md
│ │ │ ├── mongo-2.md
│ │ │ ├── mongo.md
│ │ │ ├── networking-basics.md
│ │ │ ├── nextsteps.md
│ │ │ ├── nodered.md
│ │ │ ├── prometheus.md
│ │ │ ├── secrets.md
│ │ │ ├── setup.md
│ │ │ ├── votingapp-compose.md
│ │ │ ├── votingapp-swarm.md
│ │ │ ├── webapps-part1.md
│ │ │ └── webapps-part2.md
│ │ ├── flask-app/
│ │ │ ├── Dockerfile
│ │ │ ├── app.py
│ │ │ ├── requirements.txt
│ │ │ └── templates/
│ │ │ └── index.html
│ │ ├── readme.md
│ │ └── static-site/
│ │ ├── Dockerfile
│ │ └── Hello_docker.html
│ ├── networking/
│ │ ├── A1-network-basics.md
│ │ ├── A2-bridge-networking.md
│ │ ├── A3-overlay-networking.md
│ │ ├── A4-HTTP Routing Mesh.md
│ │ ├── README.md
│ │ ├── concepts/
│ │ │ ├── 01-cnm.md
│ │ │ ├── 02-drivers.md
│ │ │ ├── 03-linux-networking.md
│ │ │ ├── 04-docker-network-cp.md
│ │ │ ├── 05-bridge-networks.md
│ │ │ ├── 06-overlay-networks.md
│ │ │ ├── 07-macvlan.md
│ │ │ ├── 08-host-networking.md
│ │ │ ├── 09-physical-networking.md
│ │ │ ├── 10-load-balancing.md
│ │ │ ├── 11-security.md
│ │ │ ├── 12-ipaddress-management.md
│ │ │ ├── 13-troubleshooting.md
│ │ │ ├── 14-network-models.md
│ │ │ └── README.md
│ │ ├── scratch.md
│ │ └── tutorials.md
│ ├── registry/
│ │ ├── README.md
│ │ ├── part-1.md
│ │ ├── part-2.md
│ │ └── part-3.md
│ ├── security/
│ │ ├── README.md
│ │ ├── apparmor/
│ │ │ ├── README.md
│ │ │ └── wordpress/
│ │ │ ├── Dockerfile
│ │ │ ├── docker-compose.yml
│ │ │ ├── html/
│ │ │ │ ├── index.php
│ │ │ │ ├── license.txt
│ │ │ │ ├── readme.html
│ │ │ │ ├── wp-activate.php
│ │ │ │ ├── wp-admin/
│ │ │ │ │ ├── about.php
│ │ │ │ │ ├── admin-ajax.php
│ │ │ │ │ ├── admin-footer.php
│ │ │ │ │ ├── admin-functions.php
│ │ │ │ │ ├── admin-header.php
│ │ │ │ │ ├── admin-post.php
│ │ │ │ │ ├── admin.php
│ │ │ │ │ ├── async-upload.php
│ │ │ │ │ ├── comment.php
│ │ │ │ │ ├── credits.php
│ │ │ │ │ ├── css/
│ │ │ │ │ │ ├── about-rtl.css
│ │ │ │ │ │ ├── about.css
│ │ │ │ │ │ ├── admin-menu-rtl.css
│ │ │ │ │ │ ├── admin-menu.css
│ │ │ │ │ │ ├── color-picker-rtl.css
│ │ │ │ │ │ ├── color-picker.css
│ │ │ │ │ │ ├── colors/
│ │ │ │ │ │ │ ├── _admin.scss
│ │ │ │ │ │ │ ├── _mixins.scss
│ │ │ │ │ │ │ ├── _variables.scss
│ │ │ │ │ │ │ ├── blue/
│ │ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ │ ├── coffee/
│ │ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ │ ├── ectoplasm/
│ │ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ │ ├── light/
│ │ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ │ ├── midnight/
│ │ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ │ ├── ocean/
│ │ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ │ └── sunrise/
│ │ │ │ │ │ │ ├── colors-rtl.css
│ │ │ │ │ │ │ ├── colors.css
│ │ │ │ │ │ │ └── colors.scss
│ │ │ │ │ │ ├── common-rtl.css
│ │ │ │ │ │ ├── common.css
│ │ │ │ │ │ ├── customize-controls-rtl.css
│ │ │ │ │ │ ├── customize-controls.css
│ │ │ │ │ │ ├── customize-nav-menus-rtl.css
│ │ │ │ │ │ ├── customize-nav-menus.css
│ │ │ │ │ │ ├── customize-widgets-rtl.css
│ │ │ │ │ │ ├── customize-widgets.css
│ │ │ │ │ │ ├── dashboard-rtl.css
│ │ │ │ │ │ ├── dashboard.css
│ │ │ │ │ │ ├── deprecated-media-rtl.css
│ │ │ │ │ │ ├── deprecated-media.css
│ │ │ │ │ │ ├── edit-rtl.css
│ │ │ │ │ │ ├── edit.css
│ │ │ │ │ │ ├── farbtastic-rtl.css
│ │ │ │ │ │ ├── farbtastic.css
│ │ │ │ │ │ ├── forms-rtl.css
│ │ │ │ │ │ ├── forms.css
│ │ │ │ │ │ ├── ie-rtl.css
│ │ │ │ │ │ ├── ie.css
│ │ │ │ │ │ ├── install-rtl.css
│ │ │ │ │ │ ├── install.css
│ │ │ │ │ │ ├── l10n-rtl.css
│ │ │ │ │ │ ├── l10n.css
│ │ │ │ │ │ ├── list-tables-rtl.css
│ │ │ │ │ │ ├── list-tables.css
│ │ │ │ │ │ ├── login-rtl.css
│ │ │ │ │ │ ├── login.css
│ │ │ │ │ │ ├── media-rtl.css
│ │ │ │ │ │ ├── media.css
│ │ │ │ │ │ ├── nav-menus-rtl.css
│ │ │ │ │ │ ├── nav-menus.css
│ │ │ │ │ │ ├── press-this-editor-rtl.css
│ │ │ │ │ │ ├── press-this-editor.css
│ │ │ │ │ │ ├── press-this-rtl.css
│ │ │ │ │ │ ├── press-this.css
│ │ │ │ │ │ ├── revisions-rtl.css
│ │ │ │ │ │ ├── revisions.css
│ │ │ │ │ │ ├── site-icon-rtl.css
│ │ │ │ │ │ ├── site-icon.css
│ │ │ │ │ │ ├── themes-rtl.css
│ │ │ │ │ │ ├── themes.css
│ │ │ │ │ │ ├── widgets-rtl.css
│ │ │ │ │ │ ├── widgets.css
│ │ │ │ │ │ ├── wp-admin-rtl.css
│ │ │ │ │ │ └── wp-admin.css
│ │ │ │ │ ├── custom-background.php
│ │ │ │ │ ├── custom-header.php
│ │ │ │ │ ├── customize.php
│ │ │ │ │ ├── edit-comments.php
│ │ │ │ │ ├── edit-form-advanced.php
│ │ │ │ │ ├── edit-form-comment.php
│ │ │ │ │ ├── edit-link-form.php
│ │ │ │ │ ├── edit-tag-form.php
│ │ │ │ │ ├── edit-tags.php
│ │ │ │ │ ├── edit.php
│ │ │ │ │ ├── export.php
│ │ │ │ │ ├── freedoms.php
│ │ │ │ │ ├── import.php
│ │ │ │ │ ├── includes/
│ │ │ │ │ │ ├── admin-filters.php
│ │ │ │ │ │ ├── admin.php
│ │ │ │ │ │ ├── ajax-actions.php
│ │ │ │ │ │ ├── bookmark.php
│ │ │ │ │ │ ├── class-ftp-pure.php
│ │ │ │ │ │ ├── class-ftp-sockets.php
│ │ │ │ │ │ ├── class-ftp.php
│ │ │ │ │ │ ├── class-pclzip.php
│ │ │ │ │ │ ├── class-walker-category-checklist.php
│ │ │ │ │ │ ├── class-walker-nav-menu-checklist.php
│ │ │ │ │ │ ├── class-walker-nav-menu-edit.php
│ │ │ │ │ │ ├── class-wp-comments-list-table.php
│ │ │ │ │ │ ├── class-wp-filesystem-base.php
│ │ │ │ │ │ ├── class-wp-filesystem-direct.php
│ │ │ │ │ │ ├── class-wp-filesystem-ftpext.php
│ │ │ │ │ │ ├── class-wp-filesystem-ftpsockets.php
│ │ │ │ │ │ ├── class-wp-filesystem-ssh2.php
│ │ │ │ │ │ ├── class-wp-importer.php
│ │ │ │ │ │ ├── class-wp-internal-pointers.php
│ │ │ │ │ │ ├── class-wp-links-list-table.php
│ │ │ │ │ │ ├── class-wp-list-table.php
│ │ │ │ │ │ ├── class-wp-media-list-table.php
│ │ │ │ │ │ ├── class-wp-ms-sites-list-table.php
│ │ │ │ │ │ ├── class-wp-ms-themes-list-table.php
│ │ │ │ │ │ ├── class-wp-ms-users-list-table.php
│ │ │ │ │ │ ├── class-wp-plugin-install-list-table.php
│ │ │ │ │ │ ├── class-wp-plugins-list-table.php
│ │ │ │ │ │ ├── class-wp-post-comments-list-table.php
│ │ │ │ │ │ ├── class-wp-posts-list-table.php
│ │ │ │ │ │ ├── class-wp-press-this.php
│ │ │ │ │ │ ├── class-wp-screen.php
│ │ │ │ │ │ ├── class-wp-site-icon.php
│ │ │ │ │ │ ├── class-wp-terms-list-table.php
│ │ │ │ │ │ ├── class-wp-theme-install-list-table.php
│ │ │ │ │ │ ├── class-wp-themes-list-table.php
│ │ │ │ │ │ ├── class-wp-upgrader-skins.php
│ │ │ │ │ │ ├── class-wp-upgrader.php
│ │ │ │ │ │ ├── class-wp-users-list-table.php
│ │ │ │ │ │ ├── comment.php
│ │ │ │ │ │ ├── continents-cities.php
│ │ │ │ │ │ ├── credits.php
│ │ │ │ │ │ ├── dashboard.php
│ │ │ │ │ │ ├── deprecated.php
│ │ │ │ │ │ ├── edit-tag-messages.php
│ │ │ │ │ │ ├── export.php
│ │ │ │ │ │ ├── file.php
│ │ │ │ │ │ ├── image-edit.php
│ │ │ │ │ │ ├── image.php
│ │ │ │ │ │ ├── import.php
│ │ │ │ │ │ ├── list-table.php
│ │ │ │ │ │ ├── media.php
│ │ │ │ │ │ ├── menu.php
│ │ │ │ │ │ ├── meta-boxes.php
│ │ │ │ │ │ ├── misc.php
│ │ │ │ │ │ ├── ms-admin-filters.php
│ │ │ │ │ │ ├── ms-deprecated.php
│ │ │ │ │ │ ├── ms.php
│ │ │ │ │ │ ├── nav-menu.php
│ │ │ │ │ │ ├── network.php
│ │ │ │ │ │ ├── noop.php
│ │ │ │ │ │ ├── options.php
│ │ │ │ │ │ ├── plugin-install.php
│ │ │ │ │ │ ├── plugin.php
│ │ │ │ │ │ ├── post.php
│ │ │ │ │ │ ├── revision.php
│ │ │ │ │ │ ├── schema.php
│ │ │ │ │ │ ├── screen.php
│ │ │ │ │ │ ├── taxonomy.php
│ │ │ │ │ │ ├── template.php
│ │ │ │ │ │ ├── theme-install.php
│ │ │ │ │ │ ├── theme.php
│ │ │ │ │ │ ├── translation-install.php
│ │ │ │ │ │ ├── update-core.php
│ │ │ │ │ │ ├── update.php
│ │ │ │ │ │ ├── upgrade.php
│ │ │ │ │ │ ├── user.php
│ │ │ │ │ │ └── widgets.php
│ │ │ │ │ ├── index.php
│ │ │ │ │ ├── install-helper.php
│ │ │ │ │ ├── install.php
│ │ │ │ │ ├── js/
│ │ │ │ │ │ ├── accordion.js
│ │ │ │ │ │ ├── bookmarklet.js
│ │ │ │ │ │ ├── color-picker.js
│ │ │ │ │ │ ├── comment.js
│ │ │ │ │ │ ├── common.js
│ │ │ │ │ │ ├── custom-background.js
│ │ │ │ │ │ ├── custom-header.js
│ │ │ │ │ │ ├── customize-controls.js
│ │ │ │ │ │ ├── customize-nav-menus.js
│ │ │ │ │ │ ├── customize-widgets.js
│ │ │ │ │ │ ├── dashboard.js
│ │ │ │ │ │ ├── edit-comments.js
│ │ │ │ │ │ ├── editor-expand.js
│ │ │ │ │ │ ├── editor.js
│ │ │ │ │ │ ├── farbtastic.js
│ │ │ │ │ │ ├── gallery.js
│ │ │ │ │ │ ├── image-edit.js
│ │ │ │ │ │ ├── inline-edit-post.js
│ │ │ │ │ │ ├── inline-edit-tax.js
│ │ │ │ │ │ ├── language-chooser.js
│ │ │ │ │ │ ├── link.js
│ │ │ │ │ │ ├── media-gallery.js
│ │ │ │ │ │ ├── media-upload.js
│ │ │ │ │ │ ├── media.js
│ │ │ │ │ │ ├── nav-menu.js
│ │ │ │ │ │ ├── password-strength-meter.js
│ │ │ │ │ │ ├── plugin-install.js
│ │ │ │ │ │ ├── post.js
│ │ │ │ │ │ ├── postbox.js
│ │ │ │ │ │ ├── press-this.js
│ │ │ │ │ │ ├── revisions.js
│ │ │ │ │ │ ├── set-post-thumbnail.js
│ │ │ │ │ │ ├── svg-painter.js
│ │ │ │ │ │ ├── tags-box.js
│ │ │ │ │ │ ├── tags.js
│ │ │ │ │ │ ├── theme.js
│ │ │ │ │ │ ├── updates.js
│ │ │ │ │ │ ├── user-profile.js
│ │ │ │ │ │ ├── user-suggest.js
│ │ │ │ │ │ ├── widgets.js
│ │ │ │ │ │ ├── word-count.js
│ │ │ │ │ │ ├── wp-fullscreen-stub.js
│ │ │ │ │ │ └── xfn.js
│ │ │ │ │ ├── link-add.php
│ │ │ │ │ ├── link-manager.php
│ │ │ │ │ ├── link-parse-opml.php
│ │ │ │ │ ├── link.php
│ │ │ │ │ ├── load-scripts.php
│ │ │ │ │ ├── load-styles.php
│ │ │ │ │ ├── maint/
│ │ │ │ │ │ └── repair.php
│ │ │ │ │ ├── media-new.php
│ │ │ │ │ ├── media-upload.php
│ │ │ │ │ ├── media.php
│ │ │ │ │ ├── menu-header.php
│ │ │ │ │ ├── menu.php
│ │ │ │ │ ├── moderation.php
│ │ │ │ │ ├── ms-admin.php
│ │ │ │ │ ├── ms-delete-site.php
│ │ │ │ │ ├── ms-edit.php
│ │ │ │ │ ├── ms-options.php
│ │ │ │ │ ├── ms-sites.php
│ │ │ │ │ ├── ms-themes.php
│ │ │ │ │ ├── ms-upgrade-network.php
│ │ │ │ │ ├── ms-users.php
│ │ │ │ │ ├── my-sites.php
│ │ │ │ │ ├── nav-menus.php
│ │ │ │ │ ├── network/
│ │ │ │ │ │ ├── about.php
│ │ │ │ │ │ ├── admin.php
│ │ │ │ │ │ ├── credits.php
│ │ │ │ │ │ ├── edit.php
│ │ │ │ │ │ ├── freedoms.php
│ │ │ │ │ │ ├── index.php
│ │ │ │ │ │ ├── menu.php
│ │ │ │ │ │ ├── plugin-editor.php
│ │ │ │ │ │ ├── plugin-install.php
│ │ │ │ │ │ ├── plugins.php
│ │ │ │ │ │ ├── profile.php
│ │ │ │ │ │ ├── settings.php
│ │ │ │ │ │ ├── setup.php
│ │ │ │ │ │ ├── site-info.php
│ │ │ │ │ │ ├── site-new.php
│ │ │ │ │ │ ├── site-settings.php
│ │ │ │ │ │ ├── site-themes.php
│ │ │ │ │ │ ├── site-users.php
│ │ │ │ │ │ ├── sites.php
│ │ │ │ │ │ ├── theme-editor.php
│ │ │ │ │ │ ├── theme-install.php
│ │ │ │ │ │ ├── themes.php
│ │ │ │ │ │ ├── update-core.php
│ │ │ │ │ │ ├── update.php
│ │ │ │ │ │ ├── upgrade.php
│ │ │ │ │ │ ├── user-edit.php
│ │ │ │ │ │ ├── user-new.php
│ │ │ │ │ │ └── users.php
│ │ │ │ │ ├── network.php
│ │ │ │ │ ├── options-discussion.php
│ │ │ │ │ ├── options-general.php
│ │ │ │ │ ├── options-head.php
│ │ │ │ │ ├── options-media.php
│ │ │ │ │ ├── options-permalink.php
│ │ │ │ │ ├── options-reading.php
│ │ │ │ │ ├── options-writing.php
│ │ │ │ │ ├── options.php
│ │ │ │ │ ├── plugin-editor.php
│ │ │ │ │ ├── plugin-install.php
│ │ │ │ │ ├── plugins.php
│ │ │ │ │ ├── post-new.php
│ │ │ │ │ ├── post.php
│ │ │ │ │ ├── press-this.php
│ │ │ │ │ ├── profile.php
│ │ │ │ │ ├── revision.php
│ │ │ │ │ ├── setup-config.php
│ │ │ │ │ ├── theme-editor.php
│ │ │ │ │ ├── theme-install.php
│ │ │ │ │ ├── themes.php
│ │ │ │ │ ├── tools.php
│ │ │ │ │ ├── update-core.php
│ │ │ │ │ ├── update.php
│ │ │ │ │ ├── upgrade-functions.php
│ │ │ │ │ ├── upgrade.php
│ │ │ │ │ ├── upload.php
│ │ │ │ │ ├── user/
│ │ │ │ │ │ ├── about.php
│ │ │ │ │ │ ├── admin.php
│ │ │ │ │ │ ├── credits.php
│ │ │ │ │ │ ├── freedoms.php
│ │ │ │ │ │ ├── index.php
│ │ │ │ │ │ ├── menu.php
│ │ │ │ │ │ ├── profile.php
│ │ │ │ │ │ └── user-edit.php
│ │ │ │ │ ├── user-edit.php
│ │ │ │ │ ├── user-new.php
│ │ │ │ │ ├── users.php
│ │ │ │ │ └── widgets.php
│ │ │ │ ├── wp-blog-header.php
│ │ │ │ ├── wp-comments-post.php
│ │ │ │ ├── wp-config.php
│ │ │ │ ├── wp-content/
│ │ │ │ │ ├── index.php
│ │ │ │ │ ├── plugins/
│ │ │ │ │ │ ├── akismet/
│ │ │ │ │ │ │ ├── .htaccess
│ │ │ │ │ │ │ ├── LICENSE.txt
│ │ │ │ │ │ │ ├── _inc/
│ │ │ │ │ │ │ │ ├── akismet.css
│ │ │ │ │ │ │ │ ├── akismet.js
│ │ │ │ │ │ │ │ └── form.js
│ │ │ │ │ │ │ ├── akismet.php
│ │ │ │ │ │ │ ├── class.akismet-admin.php
│ │ │ │ │ │ │ ├── class.akismet-widget.php
│ │ │ │ │ │ │ ├── class.akismet.php
│ │ │ │ │ │ │ ├── index.php
│ │ │ │ │ │ │ ├── readme.txt
│ │ │ │ │ │ │ ├── views/
│ │ │ │ │ │ │ │ ├── config.php
│ │ │ │ │ │ │ │ ├── get.php
│ │ │ │ │ │ │ │ ├── notice.php
│ │ │ │ │ │ │ │ ├── start.php
│ │ │ │ │ │ │ │ ├── stats.php
│ │ │ │ │ │ │ │ └── strict.php
│ │ │ │ │ │ │ └── wrapper.php
│ │ │ │ │ │ ├── hello.php
│ │ │ │ │ │ └── index.php
│ │ │ │ │ └── themes/
│ │ │ │ │ ├── index.php
│ │ │ │ │ ├── twentyfifteen/
│ │ │ │ │ │ ├── 404.php
│ │ │ │ │ │ ├── archive.php
│ │ │ │ │ │ ├── author-bio.php
│ │ │ │ │ │ ├── comments.php
│ │ │ │ │ │ ├── content-link.php
│ │ │ │ │ │ ├── content-none.php
│ │ │ │ │ │ ├── content-page.php
│ │ │ │ │ │ ├── content-search.php
│ │ │ │ │ │ ├── content.php
│ │ │ │ │ │ ├── css/
│ │ │ │ │ │ │ ├── editor-style.css
│ │ │ │ │ │ │ ├── ie.css
│ │ │ │ │ │ │ └── ie7.css
│ │ │ │ │ │ ├── footer.php
│ │ │ │ │ │ ├── functions.php
│ │ │ │ │ │ ├── genericons/
│ │ │ │ │ │ │ ├── COPYING.txt
│ │ │ │ │ │ │ ├── LICENSE.txt
│ │ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ │ └── genericons.css
│ │ │ │ │ │ ├── header.php
│ │ │ │ │ │ ├── image.php
│ │ │ │ │ │ ├── inc/
│ │ │ │ │ │ │ ├── back-compat.php
│ │ │ │ │ │ │ ├── custom-header.php
│ │ │ │ │ │ │ ├── customizer.php
│ │ │ │ │ │ │ └── template-tags.php
│ │ │ │ │ │ ├── index.php
│ │ │ │ │ │ ├── js/
│ │ │ │ │ │ │ ├── color-scheme-control.js
│ │ │ │ │ │ │ ├── customize-preview.js
│ │ │ │ │ │ │ ├── functions.js
│ │ │ │ │ │ │ ├── html5.js
│ │ │ │ │ │ │ ├── keyboard-image-navigation.js
│ │ │ │ │ │ │ └── skip-link-focus-fix.js
│ │ │ │ │ │ ├── languages/
│ │ │ │ │ │ │ └── twentyfifteen.pot
│ │ │ │ │ │ ├── page.php
│ │ │ │ │ │ ├── readme.txt
│ │ │ │ │ │ ├── rtl.css
│ │ │ │ │ │ ├── search.php
│ │ │ │ │ │ ├── sidebar.php
│ │ │ │ │ │ ├── single.php
│ │ │ │ │ │ └── style.css
│ │ │ │ │ ├── twentyfourteen/
│ │ │ │ │ │ ├── 404.php
│ │ │ │ │ │ ├── archive.php
│ │ │ │ │ │ ├── author.php
│ │ │ │ │ │ ├── category.php
│ │ │ │ │ │ ├── comments.php
│ │ │ │ │ │ ├── content-aside.php
│ │ │ │ │ │ ├── content-audio.php
│ │ │ │ │ │ ├── content-featured-post.php
│ │ │ │ │ │ ├── content-gallery.php
│ │ │ │ │ │ ├── content-image.php
│ │ │ │ │ │ ├── content-link.php
│ │ │ │ │ │ ├── content-none.php
│ │ │ │ │ │ ├── content-page.php
│ │ │ │ │ │ ├── content-quote.php
│ │ │ │ │ │ ├── content-video.php
│ │ │ │ │ │ ├── content.php
│ │ │ │ │ │ ├── css/
│ │ │ │ │ │ │ ├── editor-style.css
│ │ │ │ │ │ │ └── ie.css
│ │ │ │ │ │ ├── featured-content.php
│ │ │ │ │ │ ├── footer.php
│ │ │ │ │ │ ├── functions.php
│ │ │ │ │ │ ├── genericons/
│ │ │ │ │ │ │ ├── COPYING.txt
│ │ │ │ │ │ │ ├── Genericons-Regular.otf
│ │ │ │ │ │ │ ├── LICENSE.txt
│ │ │ │ │ │ │ ├── README.txt
│ │ │ │ │ │ │ └── genericons.css
│ │ │ │ │ │ ├── header.php
│ │ │ │ │ │ ├── image.php
│ │ │ │ │ │ ├── inc/
│ │ │ │ │ │ │ ├── back-compat.php
│ │ │ │ │ │ │ ├── custom-header.php
│ │ │ │ │ │ │ ├── customizer.php
│ │ │ │ │ │ │ ├── featured-content.php
│ │ │ │ │ │ │ ├── template-tags.php
│ │ │ │ │ │ │ └── widgets.php
│ │ │ │ │ │ ├── index.php
│ │ │ │ │ │ ├── js/
│ │ │ │ │ │ │ ├── customizer.js
│ │ │ │ │ │ │ ├── featured-content-admin.js
│ │ │ │ │ │ │ ├── functions.js
│ │ │ │ │ │ │ ├── html5.js
│ │ │ │ │ │ │ ├── keyboard-image-navigation.js
│ │ │ │ │ │ │ └── slider.js
│ │ │ │ │ │ ├── languages/
│ │ │ │ │ │ │ └── twentyfourteen.pot
│ │ │ │ │ │ ├── page-templates/
│ │ │ │ │ │ │ ├── contributors.php
│ │ │ │ │ │ │ └── full-width.php
│ │ │ │ │ │ ├── page.php
│ │ │ │ │ │ ├── readme.txt
│ │ │ │ │ │ ├── rtl.css
│ │ │ │ │ │ ├── search.php
│ │ │ │ │ │ ├── sidebar-content.php
│ │ │ │ │ │ ├── sidebar-footer.php
│ │ │ │ │ │ ├── sidebar.php
│ │ │ │ │ │ ├── single.php
│ │ │ │ │ │ ├── style.css
│ │ │ │ │ │ ├── tag.php
│ │ │ │ │ │ └── taxonomy-post_format.php
│ │ │ │ │ └── twentysixteen/
│ │ │ │ │ ├── 404.php
│ │ │ │ │ ├── archive.php
│ │ │ │ │ ├── comments.php
│ │ │ │ │ ├── css/
│ │ │ │ │ │ ├── editor-style.css
│ │ │ │ │ │ ├── ie.css
│ │ │ │ │ │ ├── ie7.css
│ │ │ │ │ │ └── ie8.css
│ │ │ │ │ ├── footer.php
│ │ │ │ │ ├── functions.php
│ │ │ │ │ ├── genericons/
│ │ │ │ │ │ ├── COPYING.txt
│ │ │ │ │ │ ├── LICENSE.txt
│ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ └── genericons.css
│ │ │ │ │ ├── header.php
│ │ │ │ │ ├── image.php
│ │ │ │ │ ├── inc/
│ │ │ │ │ │ ├── back-compat.php
│ │ │ │ │ │ ├── customizer.php
│ │ │ │ │ │ └── template-tags.php
│ │ │ │ │ ├── index.php
│ │ │ │ │ ├── js/
│ │ │ │ │ │ ├── color-scheme-control.js
│ │ │ │ │ │ ├── customize-preview.js
│ │ │ │ │ │ ├── functions.js
│ │ │ │ │ │ ├── html5.js
│ │ │ │ │ │ ├── keyboard-image-navigation.js
│ │ │ │ │ │ └── skip-link-focus-fix.js
│ │ │ │ │ ├── languages/
│ │ │ │ │ │ └── twentysixteen.pot
│ │ │ │ │ ├── page.php
│ │ │ │ │ ├── readme.txt
│ │ │ │ │ ├── rtl.css
│ │ │ │ │ ├── search.php
│ │ │ │ │ ├── searchform.php
│ │ │ │ │ ├── sidebar-content-bottom.php
│ │ │ │ │ ├── sidebar.php
│ │ │ │ │ ├── single.php
│ │ │ │ │ ├── style.css
│ │ │ │ │ └── template-parts/
│ │ │ │ │ ├── biography.php
│ │ │ │ │ ├── content-none.php
│ │ │ │ │ ├── content-page.php
│ │ │ │ │ ├── content-search.php
│ │ │ │ │ ├── content-single.php
│ │ │ │ │ └── content.php
│ │ │ │ ├── wp-cron.php
│ │ │ │ ├── wp-includes/
│ │ │ │ │ ├── ID3/
│ │ │ │ │ │ ├── getid3.lib.php
│ │ │ │ │ │ ├── getid3.php
│ │ │ │ │ │ ├── license.commercial.txt
│ │ │ │ │ │ ├── license.txt
│ │ │ │ │ │ ├── module.audio-video.asf.php
│ │ │ │ │ │ ├── module.audio-video.flv.php
│ │ │ │ │ │ ├── module.audio-video.matroska.php
│ │ │ │ │ │ ├── module.audio-video.quicktime.php
│ │ │ │ │ │ ├── module.audio-video.riff.php
│ │ │ │ │ │ ├── module.audio.ac3.php
│ │ │ │ │ │ ├── module.audio.dts.php
│ │ │ │ │ │ ├── module.audio.flac.php
│ │ │ │ │ │ ├── module.audio.mp3.php
│ │ │ │ │ │ ├── module.audio.ogg.php
│ │ │ │ │ │ ├── module.tag.apetag.php
│ │ │ │ │ │ ├── module.tag.id3v1.php
│ │ │ │ │ │ ├── module.tag.id3v2.php
│ │ │ │ │ │ ├── module.tag.lyrics3.php
│ │ │ │ │ │ └── readme.txt
│ │ │ │ │ ├── SimplePie/
│ │ │ │ │ │ ├── Author.php
│ │ │ │ │ │ ├── Cache/
│ │ │ │ │ │ │ ├── Base.php
│ │ │ │ │ │ │ ├── DB.php
│ │ │ │ │ │ │ ├── File.php
│ │ │ │ │ │ │ ├── Memcache.php
│ │ │ │ │ │ │ └── MySQL.php
│ │ │ │ │ │ ├── Cache.php
│ │ │ │ │ │ ├── Caption.php
│ │ │ │ │ │ ├── Category.php
│ │ │ │ │ │ ├── Content/
│ │ │ │ │ │ │ └── Type/
│ │ │ │ │ │ │ └── Sniffer.php
│ │ │ │ │ │ ├── Copyright.php
│ │ │ │ │ │ ├── Core.php
│ │ │ │ │ │ ├── Credit.php
│ │ │ │ │ │ ├── Decode/
│ │ │ │ │ │ │ └── HTML/
│ │ │ │ │ │ │ └── Entities.php
│ │ │ │ │ │ ├── Enclosure.php
│ │ │ │ │ │ ├── Exception.php
│ │ │ │ │ │ ├── File.php
│ │ │ │ │ │ ├── HTTP/
│ │ │ │ │ │ │ └── Parser.php
│ │ │ │ │ │ ├── IRI.php
│ │ │ │ │ │ ├── Item.php
│ │ │ │ │ │ ├── Locator.php
│ │ │ │ │ │ ├── Misc.php
│ │ │ │ │ │ ├── Net/
│ │ │ │ │ │ │ └── IPv6.php
│ │ │ │ │ │ ├── Parse/
│ │ │ │ │ │ │ └── Date.php
│ │ │ │ │ │ ├── Parser.php
│ │ │ │ │ │ ├── Rating.php
│ │ │ │ │ │ ├── Registry.php
│ │ │ │ │ │ ├── Restriction.php
│ │ │ │ │ │ ├── Sanitize.php
│ │ │ │ │ │ ├── Source.php
│ │ │ │ │ │ ├── XML/
│ │ │ │ │ │ │ └── Declaration/
│ │ │ │ │ │ │ └── Parser.php
│ │ │ │ │ │ └── gzdecode.php
│ │ │ │ │ ├── Text/
│ │ │ │ │ │ ├── Diff/
│ │ │ │ │ │ │ ├── Engine/
│ │ │ │ │ │ │ │ ├── native.php
│ │ │ │ │ │ │ │ ├── shell.php
│ │ │ │ │ │ │ │ ├── string.php
│ │ │ │ │ │ │ │ └── xdiff.php
│ │ │ │ │ │ │ ├── Renderer/
│ │ │ │ │ │ │ │ └── inline.php
│ │ │ │ │ │ │ └── Renderer.php
│ │ │ │ │ │ └── Diff.php
│ │ │ │ │ ├── admin-bar.php
│ │ │ │ │ ├── atomlib.php
│ │ │ │ │ ├── author-template.php
│ │ │ │ │ ├── bookmark-template.php
│ │ │ │ │ ├── bookmark.php
│ │ │ │ │ ├── cache.php
│ │ │ │ │ ├── canonical.php
│ │ │ │ │ ├── capabilities.php
│ │ │ │ │ ├── category-template.php
│ │ │ │ │ ├── category.php
│ │ │ │ │ ├── certificates/
│ │ │ │ │ │ └── ca-bundle.crt
│ │ │ │ │ ├── class-IXR.php
│ │ │ │ │ ├── class-feed.php
│ │ │ │ │ ├── class-http.php
│ │ │ │ │ ├── class-json.php
│ │ │ │ │ ├── class-oembed.php
│ │ │ │ │ ├── class-phpass.php
│ │ │ │ │ ├── class-phpmailer.php
│ │ │ │ │ ├── class-pop3.php
│ │ │ │ │ ├── class-simplepie.php
│ │ │ │ │ ├── class-smtp.php
│ │ │ │ │ ├── class-snoopy.php
│ │ │ │ │ ├── class-walker-category-dropdown.php
│ │ │ │ │ ├── class-walker-category.php
│ │ │ │ │ ├── class-walker-comment.php
│ │ │ │ │ ├── class-walker-page-dropdown.php
│ │ │ │ │ ├── class-walker-page.php
│ │ │ │ │ ├── class-wp-admin-bar.php
│ │ │ │ │ ├── class-wp-ajax-response.php
│ │ │ │ │ ├── class-wp-comment-query.php
│ │ │ │ │ ├── class-wp-comment.php
│ │ │ │ │ ├── class-wp-customize-control.php
│ │ │ │ │ ├── class-wp-customize-manager.php
│ │ │ │ │ ├── class-wp-customize-nav-menus.php
│ │ │ │ │ ├── class-wp-customize-panel.php
│ │ │ │ │ ├── class-wp-customize-section.php
│ │ │ │ │ ├── class-wp-customize-setting.php
│ │ │ │ │ ├── class-wp-customize-widgets.php
│ │ │ │ │ ├── class-wp-editor.php
│ │ │ │ │ ├── class-wp-embed.php
│ │ │ │ │ ├── class-wp-error.php
│ │ │ │ │ ├── class-wp-http-cookie.php
│ │ │ │ │ ├── class-wp-http-curl.php
│ │ │ │ │ ├── class-wp-http-encoding.php
│ │ │ │ │ ├── class-wp-http-ixr-client.php
│ │ │ │ │ ├── class-wp-http-proxy.php
│ │ │ │ │ ├── class-wp-http-response.php
│ │ │ │ │ ├── class-wp-http-streams.php
│ │ │ │ │ ├── class-wp-image-editor-gd.php
│ │ │ │ │ ├── class-wp-image-editor-imagick.php
│ │ │ │ │ ├── class-wp-image-editor.php
│ │ │ │ │ ├── class-wp-meta-query.php
│ │ │ │ │ ├── class-wp-network.php
│ │ │ │ │ ├── class-wp-oembed-controller.php
│ │ │ │ │ ├── class-wp-post.php
│ │ │ │ │ ├── class-wp-rewrite.php
│ │ │ │ │ ├── class-wp-role.php
│ │ │ │ │ ├── class-wp-roles.php
│ │ │ │ │ ├── class-wp-tax-query.php
│ │ │ │ │ ├── class-wp-term.php
│ │ │ │ │ ├── class-wp-theme.php
│ │ │ │ │ ├── class-wp-user-query.php
│ │ │ │ │ ├── class-wp-user.php
│ │ │ │ │ ├── class-wp-walker.php
│ │ │ │ │ ├── class-wp-widget-factory.php
│ │ │ │ │ ├── class-wp-widget.php
│ │ │ │ │ ├── class-wp-xmlrpc-server.php
│ │ │ │ │ ├── class-wp.php
│ │ │ │ │ ├── class.wp-dependencies.php
│ │ │ │ │ ├── class.wp-scripts.php
│ │ │ │ │ ├── class.wp-styles.php
│ │ │ │ │ ├── comment-template.php
│ │ │ │ │ ├── comment.php
│ │ │ │ │ ├── compat.php
│ │ │ │ │ ├── cron.php
│ │ │ │ │ ├── css/
│ │ │ │ │ │ ├── admin-bar-rtl.css
│ │ │ │ │ │ ├── admin-bar.css
│ │ │ │ │ │ ├── buttons-rtl.css
│ │ │ │ │ │ ├── buttons.css
│ │ │ │ │ │ ├── customize-preview.css
│ │ │ │ │ │ ├── dashicons.css
│ │ │ │ │ │ ├── editor-rtl.css
│ │ │ │ │ │ ├── editor.css
│ │ │ │ │ │ ├── jquery-ui-dialog-rtl.css
│ │ │ │ │ │ ├── jquery-ui-dialog.css
│ │ │ │ │ │ ├── media-views-rtl.css
│ │ │ │ │ │ ├── media-views.css
│ │ │ │ │ │ ├── wp-auth-check-rtl.css
│ │ │ │ │ │ ├── wp-auth-check.css
│ │ │ │ │ │ ├── wp-embed-template-ie.css
│ │ │ │ │ │ ├── wp-embed-template.css
│ │ │ │ │ │ ├── wp-pointer-rtl.css
│ │ │ │ │ │ └── wp-pointer.css
│ │ │ │ │ ├── customize/
│ │ │ │ │ │ ├── class-wp-customize-background-image-control.php
│ │ │ │ │ │ ├── class-wp-customize-background-image-setting.php
│ │ │ │ │ │ ├── class-wp-customize-color-control.php
│ │ │ │ │ │ ├── class-wp-customize-cropped-image-control.php
│ │ │ │ │ │ ├── class-wp-customize-filter-setting.php
│ │ │ │ │ │ ├── class-wp-customize-header-image-control.php
│ │ │ │ │ │ ├── class-wp-customize-header-image-setting.php
│ │ │ │ │ │ ├── class-wp-customize-image-control.php
│ │ │ │ │ │ ├── class-wp-customize-media-control.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-auto-add-control.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-control.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-item-control.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-item-setting.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-location-control.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-name-control.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-section.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menu-setting.php
│ │ │ │ │ │ ├── class-wp-customize-nav-menus-panel.php
│ │ │ │ │ │ ├── class-wp-customize-new-menu-control.php
│ │ │ │ │ │ ├── class-wp-customize-new-menu-section.php
│ │ │ │ │ │ ├── class-wp-customize-sidebar-section.php
│ │ │ │ │ │ ├── class-wp-customize-site-icon-control.php
│ │ │ │ │ │ ├── class-wp-customize-theme-control.php
│ │ │ │ │ │ ├── class-wp-customize-themes-section.php
│ │ │ │ │ │ ├── class-wp-customize-upload-control.php
│ │ │ │ │ │ ├── class-wp-widget-area-customize-control.php
│ │ │ │ │ │ └── class-wp-widget-form-customize-control.php
│ │ │ │ │ ├── date.php
│ │ │ │ │ ├── default-constants.php
│ │ │ │ │ ├── default-filters.php
│ │ │ │ │ ├── default-widgets.php
│ │ │ │ │ ├── deprecated.php
│ │ │ │ │ ├── embed-template.php
│ │ │ │ │ ├── embed.php
│ │ │ │ │ ├── feed-atom-comments.php
│ │ │ │ │ ├── feed-atom.php
│ │ │ │ │ ├── feed-rdf.php
│ │ │ │ │ ├── feed-rss.php
│ │ │ │ │ ├── feed-rss2-comments.php
│ │ │ │ │ ├── feed-rss2.php
│ │ │ │ │ ├── feed.php
│ │ │ │ │ ├── formatting.php
│ │ │ │ │ ├── functions.php
│ │ │ │ │ ├── functions.wp-scripts.php
│ │ │ │ │ ├── functions.wp-styles.php
│ │ │ │ │ ├── general-template.php
│ │ │ │ │ ├── http.php
│ │ │ │ │ ├── images/
│ │ │ │ │ │ └── crystal/
│ │ │ │ │ │ └── license.txt
│ │ │ │ │ ├── js/
│ │ │ │ │ │ ├── admin-bar.js
│ │ │ │ │ │ ├── autosave.js
│ │ │ │ │ │ ├── colorpicker.js
│ │ │ │ │ │ ├── comment-reply.js
│ │ │ │ │ │ ├── crop/
│ │ │ │ │ │ │ ├── cropper.css
│ │ │ │ │ │ │ └── cropper.js
│ │ │ │ │ │ ├── customize-base.js
│ │ │ │ │ │ ├── customize-loader.js
│ │ │ │ │ │ ├── customize-models.js
│ │ │ │ │ │ ├── customize-preview-nav-menus.js
│ │ │ │ │ │ ├── customize-preview-widgets.js
│ │ │ │ │ │ ├── customize-preview.js
│ │ │ │ │ │ ├── customize-views.js
│ │ │ │ │ │ ├── heartbeat.js
│ │ │ │ │ │ ├── hoverIntent.js
│ │ │ │ │ │ ├── imgareaselect/
│ │ │ │ │ │ │ ├── imgareaselect.css
│ │ │ │ │ │ │ └── jquery.imgareaselect.js
│ │ │ │ │ │ ├── jquery/
│ │ │ │ │ │ │ ├── jquery-migrate.js
│ │ │ │ │ │ │ ├── jquery.form.js
│ │ │ │ │ │ │ ├── jquery.hotkeys.js
│ │ │ │ │ │ │ ├── jquery.js
│ │ │ │ │ │ │ ├── jquery.query.js
│ │ │ │ │ │ │ ├── jquery.schedule.js
│ │ │ │ │ │ │ ├── jquery.serialize-object.js
│ │ │ │ │ │ │ ├── jquery.table-hotkeys.js
│ │ │ │ │ │ │ ├── jquery.ui.touch-punch.js
│ │ │ │ │ │ │ └── suggest.js
│ │ │ │ │ │ ├── json2.js
│ │ │ │ │ │ ├── mce-view.js
│ │ │ │ │ │ ├── media-audiovideo.js
│ │ │ │ │ │ ├── media-editor.js
│ │ │ │ │ │ ├── media-grid.js
│ │ │ │ │ │ ├── media-models.js
│ │ │ │ │ │ ├── media-views.js
│ │ │ │ │ │ ├── mediaelement/
│ │ │ │ │ │ │ ├── flashmediaelement.swf
│ │ │ │ │ │ │ ├── silverlightmediaelement.xap
│ │ │ │ │ │ │ ├── wp-mediaelement.css
│ │ │ │ │ │ │ ├── wp-mediaelement.js
│ │ │ │ │ │ │ └── wp-playlist.js
│ │ │ │ │ │ ├── plupload/
│ │ │ │ │ │ │ ├── handlers.js
│ │ │ │ │ │ │ ├── license.txt
│ │ │ │ │ │ │ ├── plupload.flash.swf
│ │ │ │ │ │ │ ├── plupload.silverlight.xap
│ │ │ │ │ │ │ └── wp-plupload.js
│ │ │ │ │ │ ├── quicktags.js
│ │ │ │ │ │ ├── shortcode.js
│ │ │ │ │ │ ├── swfobject.js
│ │ │ │ │ │ ├── swfupload/
│ │ │ │ │ │ │ ├── handlers.js
│ │ │ │ │ │ │ ├── license.txt
│ │ │ │ │ │ │ ├── plugins/
│ │ │ │ │ │ │ │ ├── swfupload.cookies.js
│ │ │ │ │ │ │ │ ├── swfupload.queue.js
│ │ │ │ │ │ │ │ ├── swfupload.speed.js
│ │ │ │ │ │ │ │ └── swfupload.swfobject.js
│ │ │ │ │ │ │ ├── swfupload.js
│ │ │ │ │ │ │ └── swfupload.swf
│ │ │ │ │ │ ├── thickbox/
│ │ │ │ │ │ │ ├── thickbox.css
│ │ │ │ │ │ │ └── thickbox.js
│ │ │ │ │ │ ├── tinymce/
│ │ │ │ │ │ │ ├── langs/
│ │ │ │ │ │ │ │ └── wp-langs-en.js
│ │ │ │ │ │ │ ├── license.txt
│ │ │ │ │ │ │ ├── plugins/
│ │ │ │ │ │ │ │ ├── charmap/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── colorpicker/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── compat3x/
│ │ │ │ │ │ │ │ │ ├── css/
│ │ │ │ │ │ │ │ │ │ └── dialog.css
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── directionality/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── fullscreen/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── hr/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── image/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── lists/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── media/
│ │ │ │ │ │ │ │ │ ├── moxieplayer.swf
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── paste/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── tabfocus/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── textcolor/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wordpress/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wpautoresize/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wpdialogs/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wpeditimage/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wpembed/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wpemoji/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wpgallery/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wplink/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ ├── wptextpattern/
│ │ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ │ └── wpview/
│ │ │ │ │ │ │ │ └── plugin.js
│ │ │ │ │ │ │ ├── skins/
│ │ │ │ │ │ │ │ ├── lightgray/
│ │ │ │ │ │ │ │ │ └── fonts/
│ │ │ │ │ │ │ │ │ └── readme.md
│ │ │ │ │ │ │ │ └── wordpress/
│ │ │ │ │ │ │ │ └── wp-content.css
│ │ │ │ │ │ │ ├── themes/
│ │ │ │ │ │ │ │ └── modern/
│ │ │ │ │ │ │ │ └── theme.js
│ │ │ │ │ │ │ ├── tiny_mce_popup.js
│ │ │ │ │ │ │ ├── utils/
│ │ │ │ │ │ │ │ ├── editable_selects.js
│ │ │ │ │ │ │ │ ├── form_utils.js
│ │ │ │ │ │ │ │ ├── mctabs.js
│ │ │ │ │ │ │ │ └── validate.js
│ │ │ │ │ │ │ └── wp-tinymce.php
│ │ │ │ │ │ ├── tw-sack.js
│ │ │ │ │ │ ├── twemoji.js
│ │ │ │ │ │ ├── utils.js
│ │ │ │ │ │ ├── wp-a11y.js
│ │ │ │ │ │ ├── wp-ajax-response.js
│ │ │ │ │ │ ├── wp-auth-check.js
│ │ │ │ │ │ ├── wp-backbone.js
│ │ │ │ │ │ ├── wp-embed-template.js
│ │ │ │ │ │ ├── wp-embed.js
│ │ │ │ │ │ ├── wp-emoji-loader.js
│ │ │ │ │ │ ├── wp-emoji.js
│ │ │ │ │ │ ├── wp-list-revisions.js
│ │ │ │ │ │ ├── wp-lists.js
│ │ │ │ │ │ ├── wp-pointer.js
│ │ │ │ │ │ ├── wp-util.js
│ │ │ │ │ │ ├── wpdialog.js
│ │ │ │ │ │ ├── wplink.js
│ │ │ │ │ │ └── zxcvbn-async.js
│ │ │ │ │ ├── kses.php
│ │ │ │ │ ├── l10n.php
│ │ │ │ │ ├── link-template.php
│ │ │ │ │ ├── load.php
│ │ │ │ │ ├── locale.php
│ │ │ │ │ ├── media-template.php
│ │ │ │ │ ├── media.php
│ │ │ │ │ ├── meta.php
│ │ │ │ │ ├── ms-blogs.php
│ │ │ │ │ ├── ms-default-constants.php
│ │ │ │ │ ├── ms-default-filters.php
│ │ │ │ │ ├── ms-deprecated.php
│ │ │ │ │ ├── ms-files.php
│ │ │ │ │ ├── ms-functions.php
│ │ │ │ │ ├── ms-load.php
│ │ │ │ │ ├── ms-settings.php
│ │ │ │ │ ├── nav-menu-template.php
│ │ │ │ │ ├── nav-menu.php
│ │ │ │ │ ├── option.php
│ │ │ │ │ ├── pluggable-deprecated.php
│ │ │ │ │ ├── pluggable.php
│ │ │ │ │ ├── plugin.php
│ │ │ │ │ ├── pomo/
│ │ │ │ │ │ ├── entry.php
│ │ │ │ │ │ ├── mo.php
│ │ │ │ │ │ ├── po.php
│ │ │ │ │ │ ├── streams.php
│ │ │ │ │ │ └── translations.php
│ │ │ │ │ ├── post-formats.php
│ │ │ │ │ ├── post-template.php
│ │ │ │ │ ├── post-thumbnail-template.php
│ │ │ │ │ ├── post.php
│ │ │ │ │ ├── query.php
│ │ │ │ │ ├── random_compat/
│ │ │ │ │ │ ├── byte_safe_strings.php
│ │ │ │ │ │ ├── cast_to_int.php
│ │ │ │ │ │ ├── error_polyfill.php
│ │ │ │ │ │ ├── random.php
│ │ │ │ │ │ ├── random_bytes_com_dotnet.php
│ │ │ │ │ │ ├── random_bytes_dev_urandom.php
│ │ │ │ │ │ ├── random_bytes_libsodium.php
│ │ │ │ │ │ ├── random_bytes_mcrypt.php
│ │ │ │ │ │ ├── random_bytes_openssl.php
│ │ │ │ │ │ └── random_int.php
│ │ │ │ │ ├── registration-functions.php
│ │ │ │ │ ├── registration.php
│ │ │ │ │ ├── rest-api/
│ │ │ │ │ │ ├── class-wp-rest-request.php
│ │ │ │ │ │ ├── class-wp-rest-response.php
│ │ │ │ │ │ └── class-wp-rest-server.php
│ │ │ │ │ ├── rest-api.php
│ │ │ │ │ ├── revision.php
│ │ │ │ │ ├── rewrite.php
│ │ │ │ │ ├── rss-functions.php
│ │ │ │ │ ├── rss.php
│ │ │ │ │ ├── script-loader.php
│ │ │ │ │ ├── session.php
│ │ │ │ │ ├── shortcodes.php
│ │ │ │ │ ├── taxonomy.php
│ │ │ │ │ ├── template-loader.php
│ │ │ │ │ ├── template.php
│ │ │ │ │ ├── theme-compat/
│ │ │ │ │ │ ├── comments-popup.php
│ │ │ │ │ │ ├── comments.php
│ │ │ │ │ │ ├── footer.php
│ │ │ │ │ │ ├── header.php
│ │ │ │ │ │ └── sidebar.php
│ │ │ │ │ ├── theme.php
│ │ │ │ │ ├── update.php
│ │ │ │ │ ├── user.php
│ │ │ │ │ ├── vars.php
│ │ │ │ │ ├── version.php
│ │ │ │ │ ├── widgets/
│ │ │ │ │ │ ├── class-wp-nav-menu-widget.php
│ │ │ │ │ │ ├── class-wp-widget-archives.php
│ │ │ │ │ │ ├── class-wp-widget-calendar.php
│ │ │ │ │ │ ├── class-wp-widget-categories.php
│ │ │ │ │ │ ├── class-wp-widget-links.php
│ │ │ │ │ │ ├── class-wp-widget-meta.php
│ │ │ │ │ │ ├── class-wp-widget-pages.php
│ │ │ │ │ │ ├── class-wp-widget-recent-comments.php
│ │ │ │ │ │ ├── class-wp-widget-recent-posts.php
│ │ │ │ │ │ ├── class-wp-widget-rss.php
│ │ │ │ │ │ ├── class-wp-widget-search.php
│ │ │ │ │ │ ├── class-wp-widget-tag-cloud.php
│ │ │ │ │ │ └── class-wp-widget-text.php
│ │ │ │ │ ├── widgets.php
│ │ │ │ │ ├── wlwmanifest.xml
│ │ │ │ │ ├── wp-db.php
│ │ │ │ │ └── wp-diff.php
│ │ │ │ ├── wp-links-opml.php
│ │ │ │ ├── wp-load.php
│ │ │ │ ├── wp-login.php
│ │ │ │ ├── wp-mail.php
│ │ │ │ ├── wp-settings.php
│ │ │ │ ├── wp-signup.php
│ │ │ │ ├── wp-trackback.php
│ │ │ │ └── xmlrpc.php
│ │ │ ├── php.ini
│ │ │ ├── wparmor
│ │ │ └── zues/
│ │ │ ├── LICENSE
│ │ │ ├── archive.php
│ │ │ ├── assets/
│ │ │ │ └── js/
│ │ │ │ ├── customizer.js
│ │ │ │ └── scripts.js
│ │ │ ├── comments.php
│ │ │ ├── functions.php
│ │ │ ├── index.php
│ │ │ ├── page-templates/
│ │ │ │ └── full-width.php
│ │ │ ├── readme.txt
│ │ │ ├── rtl.css
│ │ │ ├── search.php
│ │ │ ├── singular.php
│ │ │ ├── style.css
│ │ │ ├── template-parts/
│ │ │ │ ├── footers/
│ │ │ │ │ └── footer-example.php
│ │ │ │ ├── headers/
│ │ │ │ │ └── header-example.php
│ │ │ │ └── sidebars/
│ │ │ │ └── sidebar.php
│ │ │ └── zues-framework/
│ │ │ ├── assets/
│ │ │ │ ├── css/
│ │ │ │ │ ├── base.css
│ │ │ │ │ ├── font-awesome.css
│ │ │ │ │ ├── grid.css
│ │ │ │ │ └── normalize.css
│ │ │ │ ├── fonts/
│ │ │ │ │ └── FontAwesome.otf
│ │ │ │ └── js/
│ │ │ │ ├── superfish.js
│ │ │ │ └── tinynav.js
│ │ │ ├── classes/
│ │ │ │ └── class-admin-notices.php
│ │ │ ├── functions/
│ │ │ │ ├── attr.php
│ │ │ │ ├── generate-css.php
│ │ │ │ ├── helpers.php
│ │ │ │ ├── template-tags.php
│ │ │ │ ├── templates.php
│ │ │ │ └── widget-areas.php
│ │ │ ├── init.php
│ │ │ ├── libraries/
│ │ │ │ ├── TGMPA/
│ │ │ │ │ └── class-tgm-plugin-activation.php
│ │ │ │ └── customizer/
│ │ │ │ ├── README.md
│ │ │ │ ├── custom-controls/
│ │ │ │ │ ├── content.php
│ │ │ │ │ └── textarea.php
│ │ │ │ ├── customizer-library.php
│ │ │ │ ├── extensions/
│ │ │ │ │ ├── fonts.php
│ │ │ │ │ ├── interface.php
│ │ │ │ │ ├── preview.php
│ │ │ │ │ ├── sanitization.php
│ │ │ │ │ ├── style-builder.php
│ │ │ │ │ └── utilities.php
│ │ │ │ └── js/
│ │ │ │ └── customizer.js
│ │ │ └── structure/
│ │ │ ├── comments.php
│ │ │ ├── filters.php
│ │ │ ├── footer.php
│ │ │ ├── general.php
│ │ │ ├── header.php
│ │ │ ├── hooks.php
│ │ │ ├── page.php
│ │ │ ├── post.php
│ │ │ ├── primary-nav.php
│ │ │ ├── sidebar.php
│ │ │ ├── template-parts/
│ │ │ │ ├── archive-header.php
│ │ │ │ ├── comment.php
│ │ │ │ ├── comments-nav.php
│ │ │ │ ├── content-none.php
│ │ │ │ ├── footer.php
│ │ │ │ ├── head.php
│ │ │ │ ├── header.php
│ │ │ │ ├── primary-nav.php
│ │ │ │ └── search-header.php
│ │ │ └── wrapper.php
│ │ ├── capabilities/
│ │ │ └── README.md
│ │ ├── cgroups/
│ │ │ ├── README.md
│ │ │ └── cpu-stress/
│ │ │ ├── Dockerfile
│ │ │ └── docker-compose.yml
│ │ ├── networking/
│ │ │ └── README.md
│ │ ├── scanning/
│ │ │ └── README.md
│ │ ├── seccomp/
│ │ │ ├── README.md
│ │ │ └── seccomp-profiles/
│ │ │ ├── allow.json
│ │ │ ├── default-no-chmod.json
│ │ │ ├── default.json
│ │ │ └── deny.json
│ │ ├── secrets/
│ │ │ └── README.md
│ │ ├── secrets-ddc/
│ │ │ └── README.md
│ │ ├── swarm/
│ │ │ └── README.md
│ │ ├── trust/
│ │ │ └── README.md
│ │ ├── trust-basics/
│ │ │ └── README.md
│ │ └── userns/
│ │ └── README.md
│ └── swarm-mode/
│ ├── README.md
│ └── beginner-tutorial/
│ ├── README.md
│ ├── swarm-node-hyperv-setup.ps1
│ ├── swarm-node-hyperv-teardown.ps1
│ ├── swarm-node-vbox-setup.sh
│ └── swarm-node-vbox-teardown.sh
├── DockerCon/
│ ├── logging/
│ │ ├── getting-started.md
│ │ ├── log-drivers.md
│ │ └── setup.md
│ ├── monitoring/
│ │ ├── cadvisor.md
│ │ ├── monitoring-stack.md
│ │ └── stats.md
│ ├── readme.md
│ └── resources/
│ └── links.md
├── Kubernetes/
│ ├── README.md
│ ├── additional-ressources/
│ │ ├── README.md
│ │ └── kops-howto.md
│ ├── helm/
│ │ └── quickstart-helm.md
│ ├── jumpstart-downloadtools.md
│ ├── kickstart/
│ │ └── README.md
│ ├── minikube/
│ │ └── minikube-quickstart.md
│ └── third-party-coscale/
│ └── quickstart-coscale.md
├── LICENSE
├── README.md
├── _config.yml
├── contribute.md
└── istio-workshop/
├── .gitignore
├── 1_envoy/
│ ├── 1_run_httpbin.sh
│ ├── 2_curl_httpbin.sh
│ ├── 3_envoyconfig.yaml
│ ├── 3_run_envoy.sh
│ ├── 4_run_envoy_retries.sh
│ ├── 4_run_envoy_retries.yaml
│ ├── 5_query_thru_envoy.sh
│ ├── 6_fault_injection.sh
│ └── 7_metrics.sh
├── 2_istio/
│ ├── 1_crds.sh
│ ├── 1_crds.yaml
│ ├── 2_gen_install_yaml.sh
│ ├── 3_install_istio.sh
│ ├── 4_open_addons.sh
│ ├── 99_remove.sh
│ ├── charts_1.0.2/
│ │ ├── Chart.yaml
│ │ ├── README.md
│ │ ├── charts/
│ │ │ ├── certmanager/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── crds.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── issuer.yaml
│ │ │ │ ├── rbac.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── galley/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ ├── serviceaccount.yaml
│ │ │ │ └── validatingwehookconfiguration.yaml.tpl
│ │ │ ├── gateways/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── autoscale.yaml
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebindings.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── grafana/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── create-custom-resources-job.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── grafana-ports-mtls.yaml
│ │ │ │ ├── pvc.yaml
│ │ │ │ ├── secret.yaml
│ │ │ │ └── service.yaml
│ │ │ ├── ingress/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── autoscale.yaml
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── kiali/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── ingress.yaml
│ │ │ │ ├── secrets.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── mixer/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── autoscale.yaml
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── config.yaml
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ ├── serviceaccount.yaml
│ │ │ │ └── statsdtoprom.yaml
│ │ │ ├── pilot/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── autoscale.yaml
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── gateway.yaml
│ │ │ │ ├── meshexpansion.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── prometheus/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebindings.yaml
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── security/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── cleanup-secrets.yaml
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── create-custom-resources-job.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── enable-mesh-mtls.yaml
│ │ │ │ ├── meshexpansion.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── servicegraph/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── ingress.yaml
│ │ │ │ └── service.yaml
│ │ │ ├── sidecarInjectorWebhook/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── clusterrole.yaml
│ │ │ │ ├── clusterrolebinding.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── mutatingwebhook.yaml
│ │ │ │ ├── service.yaml
│ │ │ │ └── serviceaccount.yaml
│ │ │ ├── telemetry-gateway/
│ │ │ │ ├── Chart.yaml
│ │ │ │ └── templates/
│ │ │ │ └── gateway.yaml
│ │ │ └── tracing/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── deployment.yaml
│ │ │ ├── ingress-jaeger.yaml
│ │ │ ├── ingress.yaml
│ │ │ ├── service-jaeger.yaml
│ │ │ └── service.yaml
│ │ ├── requirements.yaml
│ │ ├── templates/
│ │ │ ├── _affinity.tpl
│ │ │ ├── _helpers.tpl
│ │ │ ├── configmap.yaml
│ │ │ ├── crds.yaml
│ │ │ ├── install-custom-resources.sh.tpl
│ │ │ └── sidecar-injector-configmap.yaml
│ │ ├── values-istio-auth-galley.yaml
│ │ ├── values-istio-auth-multicluster.yaml
│ │ ├── values-istio-auth.yaml
│ │ ├── values-istio-demo-auth.yaml
│ │ ├── values-istio-demo.yaml
│ │ ├── values-istio-galley.yaml
│ │ ├── values-istio-gateways.yaml
│ │ ├── values-istio-multicluster.yaml
│ │ ├── values-istio-one-namespace-auth.yaml
│ │ ├── values-istio-one-namespace.yaml
│ │ ├── values-istio.yaml
│ │ └── values.yaml
│ └── charts_1.0.4/
│ ├── Chart.yaml
│ ├── README.md
│ ├── charts/
│ │ ├── certmanager/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── crds.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── issuer.yaml
│ │ │ ├── rbac.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── galley/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── service.yaml
│ │ │ ├── serviceaccount.yaml
│ │ │ └── validatingwehookconfiguration.yaml.tpl
│ │ ├── gateways/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── autoscale.yaml
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebindings.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── grafana/
│ │ │ ├── Chart.yaml
│ │ │ ├── dashboards/
│ │ │ │ ├── galley-dashboard.json
│ │ │ │ ├── istio-mesh-dashboard.json
│ │ │ │ ├── istio-performance-dashboard.json
│ │ │ │ ├── istio-service-dashboard.json
│ │ │ │ ├── istio-workload-dashboard.json
│ │ │ │ ├── mixer-dashboard.json
│ │ │ │ └── pilot-dashboard.json
│ │ │ ├── templates/
│ │ │ │ ├── _helpers.tpl
│ │ │ │ ├── configmap-custom-resources.yaml
│ │ │ │ ├── configmap-dashboards.yaml
│ │ │ │ ├── configmap.yaml
│ │ │ │ ├── create-custom-resources-job.yaml
│ │ │ │ ├── deployment.yaml
│ │ │ │ ├── grafana-ports-mtls.yaml
│ │ │ │ ├── pvc.yaml
│ │ │ │ ├── secret.yaml
│ │ │ │ └── service.yaml
│ │ │ └── values.yaml
│ │ ├── ingress/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── autoscale.yaml
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── kiali/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── ingress.yaml
│ │ │ ├── secrets.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── mixer/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── autoscale.yaml
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── config.yaml
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── pilot/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── autoscale.yaml
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── gateway.yaml
│ │ │ ├── meshexpansion.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── prometheus/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebindings.yaml
│ │ │ ├── configmap.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── security/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── cleanup-secrets.yaml
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── configmap.yaml
│ │ │ ├── create-custom-resources-job.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── enable-mesh-mtls.yaml
│ │ │ ├── enable-mesh-permissive.yaml
│ │ │ ├── meshexpansion.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── servicegraph/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── deployment.yaml
│ │ │ ├── ingress.yaml
│ │ │ └── service.yaml
│ │ ├── sidecarInjectorWebhook/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ ├── _helpers.tpl
│ │ │ ├── clusterrole.yaml
│ │ │ ├── clusterrolebinding.yaml
│ │ │ ├── deployment.yaml
│ │ │ ├── mutatingwebhook.yaml
│ │ │ ├── service.yaml
│ │ │ └── serviceaccount.yaml
│ │ ├── telemetry-gateway/
│ │ │ ├── Chart.yaml
│ │ │ └── templates/
│ │ │ └── gateway.yaml
│ │ └── tracing/
│ │ ├── Chart.yaml
│ │ └── templates/
│ │ ├── _helpers.tpl
│ │ ├── deployment.yaml
│ │ ├── ingress-jaeger.yaml
│ │ ├── ingress.yaml
│ │ ├── service-jaeger.yaml
│ │ └── service.yaml
│ ├── requirements.yaml
│ ├── templates/
│ │ ├── _affinity.tpl
│ │ ├── _helpers.tpl
│ │ ├── configmap.yaml
│ │ ├── crds.yaml
│ │ ├── install-custom-resources.sh.tpl
│ │ └── sidecar-injector-configmap.yaml
│ ├── values-istio-auth-galley.yaml
│ ├── values-istio-auth-multicluster.yaml
│ ├── values-istio-auth.yaml
│ ├── values-istio-demo-auth.yaml
│ ├── values-istio-demo.yaml
│ ├── values-istio-galley.yaml
│ ├── values-istio-gateways.yaml
│ ├── values-istio-multicluster.yaml
│ ├── values-istio-one-namespace-auth.yaml
│ ├── values-istio-one-namespace.yaml
│ ├── values-istio.yaml
│ └── values.yaml
├── 3_application/
│ ├── 1_bookinfo-gateway.yaml
│ ├── 1_bookinfo.yaml
│ ├── 1_destination-rule-all-mtls.yaml
│ ├── 1_install_bookinfo.sh
│ └── 99_remove.sh
├── 4_traffic/
│ ├── 0_generate_traffic.sh
│ ├── 1_traffic_to_v1.sh
│ ├── 1_virtual-service-all-v1.yaml
│ ├── 2_jason_uses_v2.sh
│ ├── 2_virtual-service-reviews-test-v2.yaml
│ ├── 3_default_to_v3.sh
│ ├── 3_virtual-service-reviews-jason-v2-v3.yaml
│ └── 99_remove.sh
├── 5_chaos/
│ ├── 1_fault-injection.sh
│ ├── 1_virtual-service-ratings-test-delay.yaml
│ ├── 2_gw.sh
│ └── 3_proxy.sh
├── 6_webhook/
│ ├── 1_istio-sidecar-injector.sh
│ ├── 2_busybox-injected.sh
│ ├── busybox-injected.yaml
│ ├── busybox.yaml
│ └── inject-config.yaml
├── 7_network_policies/
│ ├── 1_setup.sh
│ └── tcpdump.sh
├── 8_nodes/
│ ├── iptables.sh
│ └── proxy_init.sh
├── README.md
├── cleanup.sh
└── slides.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitmodules
================================================
================================================
FILE: CNAME
================================================
training.56kcloud.io
================================================
FILE: Cloud/README.md
================================================
================================================
FILE: DevOps/README.md
================================================
================================================
FILE: DevOpsDays/readme.md
================================================
## DevOpsDays Docker Training
Welcome to [56K.Cloud](https://www.56k.cloud) Docker Introduction Training.
This Docker tutorial consists of the following sections:
* [Docker Getting Started with Containers](https://training.play-with-docker.com/ops-s1-hello/)
* [Docker Images](https://training.play-with-docker.com/ops-s1-images/)
* [Docker Networking](https://training.play-with-docker.com/docker-networking-hol/)
* [Docker Swarm](https://training.play-with-docker.com/ops-s1-swarm-intro/)
================================================
FILE: Docker/12factor/00_application.md
================================================
# Build the application
To illustrate the 12 factors, we start by creating a simple Node.js application as a HTTP Rest API exposing CRUD verbs on a *message* model.
There is a couple of prerequisite to build this application
* [Node.js 4.4.5 (LTS)](https://nodejs.org/en/)
* [mongo 3.2](https://docs.mongodb.org/manual/installation/)
## Routes exposed
HTTP verb | URI | Action
----------| --- | ------
GET | /message | list all messages
GET | /message/ID | get message with ID
POST | /message | create a new message
PUT | /message/ID | modify message with ID
DELETE | /message/ID | delete message with ID
## Setup
* Install Sails.js (it's to Node.js what RoR is to Ruby): `sudo npm install sails -g`
* Create the application: `sails new messageApp && cd messageApp`
* Launch the application: `sails lift`
## First tests
Create new messages
```
curl -XPOST http://localhost:1337/message?text=hello
curl -XPOST http://localhost:1337/message?text=hola
```
Get list of messages
```
curl http://localhost:1337/message
[
{
"text": "hello",
"createdAt": "2015-11-08T13:15:15.363Z",
"updatedAt": "2015-11-08T13:15:15.363Z",
"id": "5638b363c5cd0825511690bd"
},
{
"text": "hola",
"createdAt": "2015-11-08T13:15:45.774Z",
"updatedAt": "2015-11-08T13:15:45.774Z",
"id": "5638b381c5cd0825511690be"
}
]
```
Modify a message
```
curl -XPUT http://localhost:1337/message/5638b363c5cd0825511690bd?text=hey
```
Delete a message
```
curl -XDELETE http://localhost:1337/message/5638b381c5cd0825511690be
```
Get updates list of messages
```
curl http://localhost:1337/message
[
{
"text": "hey",
"createdAt": "2015-11-08T13:15:15.363Z",
"updatedAt": "2015-11-08T13:19:40.179Z",
"id": "5638b363c5cd0825511690bd"
}
]
```
[Next](01_codebase.md)
================================================
FILE: Docker/12factor/01_codebase.md
================================================
# 1 - Codebase
**one application <=> one codebase**
If there are several codebase, it's not an application, it's a distributed system containing multiple applications.
One codebase used for several deployments of the application
* development
* staging
* production
## What does that mean for our application ?
We will use Git versioning system (could have chosen subversion, ...) to handle our source code.
* Create a repo on [Github](https://github.com)
* Put the code under git
```
$ echo "# messageApp" >> README.md
$ git init
$ git add .
$ git commit -m 'First commit'
$ git remote add origin git@github.com:GITUSER/messageApp.git
$ git push origin master
```
The update we've done is not linked with Docker, but we'll see in a next chapter that this will greatly help the integration of several components of the Docker ecosystem.
[Previous](00_application.md) - [Next](02_dependencies.md)
================================================
FILE: Docker/12factor/02_dependencies.md
================================================
# 2 - Dependencies
Application's dependencies must be declared and isolated
## What does that mean for our application ?
Declaration are done in package.json file.
Let's add sails-mongo (mongodb driver) as we'll need it very quicky
`npm install sails-mongo --save`
The package.json file should look like the following:
```
{
"name": "messageApp",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"ejs": "2.3.4",
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-coffee": "0.13.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jst": "0.6.0",
"grunt-contrib-less": "1.1.0",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.5.3",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.2.4",
"include-all": "~0.1.6",
"rc": "1.0.1",
"sails": "~0.12.3",
"sails-disk": "~0.10.9",
"sails-mongo": "^0.12.0" // Newly added dependency
},
"scripts": {
"debug": "node debug app.js",
"start": "node app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/GITUSER/messageApp.git"
},
"author": "AUTHOR",
"license": ""
}
```
Dependencies are isolated within _node-modules_ folder where all the [npm](https://npmjs.org) libraries are compiled and installed.
```
$ ls node_modules/
ejs grunt-contrib-coffee grunt-contrib-cssmin grunt-contrib-uglify grunt-sync sails
grunt grunt-contrib-concat grunt-contrib-jst grunt-contrib-watch include-all sails-disk
grunt-contrib-clean grunt-contrib-copy grunt-contrib-less grunt-sails-linker rc sails-mongo
```
[Previous](01_codebase.md) - [Next](03_configuration.md)
================================================
FILE: Docker/12factor/03_configuration.md
================================================
# 3 - Configuration
Configuration (credentials, database connection string, ...) should be stored in the environment.
## What does that mean for our application ?
In _config/connections.js_, we define the _mongo_ connection and use MONGO_URL environment variable to pass the mongo connection string.
```node
module.exports.connections = {
mongo: {
adapter: 'sails-mongo',
url: process.env.MONGO_URL
}
};
```
In _config/model.js_, we make sure the _mongo_ connection defined above is the one used.
```node
module.exports.models = {
connection: 'mongo',
migrate: 'safe'
};
```
Those changes enable to provide a different _MONGO_URL_ very easily as it's defined in the environment.
[Previous](02_dependencies.md) - [Next ](04_external_services.md)
================================================
FILE: Docker/12factor/04_external_services.md
================================================
# 4 - External services
Handle external services as external resources of the application.
Examples:
* database
* log services
* ...
This ensure the application is loosely coupled with the services so it can easily switch provider or instance if needed
## What does that mean for our application ?
At this point, the only external service the application is using is MongoDB database. The loose coupling is already done by the MONGO_URL used to pass the connection string.
If something wrong happens with our instance of MongoDB (assuming a single instance is used, which is generally a bad idea...), we can easily switch to a new instance, providing a new MONGO_URL environment variable and restarting the application.
[Previous](03_configuration.md) - [Next](05_build_release_run.md)
================================================
FILE: Docker/12factor/05_build_release_run.md
================================================
# 5 - Build / Release / Run
Build / Release and Run phases must be kept separated

A release is deployed on the execution environment and must be immutable.
## What does that mean for our application ?
We'll use Docker in the whole development pipeline. We will start by adding a Dockerfile that will help define the build phase (during which the dependencies are compiled in _node-modules_ folder)
```
FROM node:4.4.5
ENV LAST_UPDATED 20160617T185400
# Copy source code
COPY . /app
# Change working directory
WORKDIR /app
# Install dependencies
RUN npm install
# Expose API port to the outside
ENV PORT 80
EXPOSE 80
# Launch application
CMD ["npm","start"]
```
Let's build our application `$ docker build -t message-app:v0.1 .`
And verify the resulting image is in the list of available images
```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
message-app v0.1 f35464cf4b0b 2 seconds ago 769 MB
```
Now the image (build) is available, execution environment must be injected to create a release.
There are several options to inject the configuration in the build, among them
* create a new image based on the build
* define a Compose file
We'll go for the second option and define a docker-compose file where the MONGO_URL will be set with the value of the execution environment
```
version: '3'
services:
mongo:
image: mongo:3.2
volumes:
- mongo-data:/data/db
expose:
- "27017"
app:
image: message-app:v0.1
ports:
- "8000:80"
links:
- mongo
depends_on:
- mongo
environment:
- MONGO_URL=mongodb://mongo/messageApp
volumes:
mongo-data:
```
This file defines a release as it considers a given build and inject the execution environment.
The run phase can be done manually with Compose CLI or through an orchestrator (Docker Cloud).
Compose CLI enables to run the global application as simple as `docker-compose up -d`
[Previous](04_external_services.md) - [Next](06_processes.md)
================================================
FILE: Docker/12factor/06_processes.md
================================================
# 6 - Processes
An application is made up of several processes.
Each process must be stateless and must not have local storage (sessions, ...).
This is required
* for scalability
* fault tolerance (crashes, ...)
The data that need to be persisted, must be saved in a stateful resources (Database, shared filesystem, ...)
Eg: sessions can easily be saved in a Redis kv store
Note: Sticky session violate 12 factor.
## What does that mean for our application ?
In _config/sessions.js_, we need to modify the adapter to store session in a distributed Redis kv store (MongoDB is another possible option).
```
module.exports.session = {
...
adapter: 'redis',
host: process.env.REDIS_HOST || 'localhost',
...
};
```
Once done, the app needs to be rebuilt `docker build -t message-app:v0.2 .`
**REDIS_HOST** needs to be added to the docker-compose file as the new release will run against this kv store.
```
version: '3'
services:
mongo:
image: mongo:3.2
volumes:
- mongo-data:/data/db
expose:
- "27017"
kv:
image: redis:alpine
volumes:
- redis-data:/data
expose:
- "6379"
app:
image: message-app:v0.2 # New version taking into account REDIS_URL
ports:
- "8000:80"
links:
- mongo
depends_on:
- mongo
environment:
- MONGO_URL=mongodb://mongo/messageApp
- REDIS_URL=redis
volumes:
mongo-data:
redis-data:
```
[Previous](05_build_release_run.md) - [Next](07_port_binding.md)
================================================
FILE: Docker/12factor/07_port_binding.md
================================================
# 7 - Port binding
This factor is related to the exposition of the application to the outside.
To be compliant with 12 factor, an app must use specialized dependencies (such as http server, ...) and exposes its service through a port.
The host has the responsibility to route the request to the correct application through port mapping.
## What does that mean for our application ?
Docker already handles that for us, as we can see in the docker-compose file. The **app** container exposes port 80 internally and the host maps it against its port 8000.
```
version: '3'
services:
mongo:
image: mongo:3.2
volumes:
- mongo-data:/data/db
expose:
- "27017"
kv:
image: redis:alpine
volumes:
- redis-data:/data
expose:
- "6379"
app:
image: message-app:v0.2 # New version taking into account REDIS_URL
ports:
- "8000:80" // app service is exposed on the port 8000 of the host
links:
- mongo
depends_on:
- mongo
environment:
- MONGO_URL=mongodb://mongo/messageApp
- REDIS_URL=redis
volumes:
mongo-data:
redis-data:
```
If several instances of the app services needs to be deployed, the configuration above cannot be used as a given port on the host cannot map several ports in the containers.
In this case, we can use a load balancer to which the host will map a port. The load balancer will then be in charge to balance the traffic on the different instances of the services.
[Previous](06_processes.md) - [Next](08_concurrency.md)
================================================
FILE: Docker/12factor/08_concurrency.md
================================================
# 8 - Concurrency
Horizontal scalability with the processes model.
The app can be seen as a set of processes of different types
* web server
* worker
* cron
Each process needs to be able to scale horizontally, it can have its own internal multiplexing.
## What does that mean for our application ?
The messageApp only have one type of process (http server), it's doing the multiplexing using Node.js http server.
This process can be easily scalable (stateless process).
[Previous](07_port_binding.md) - [Next](09_disposability.md)
================================================
FILE: Docker/12factor/09_disposability.md
================================================
# 9 - Disposability
Each process of an application must be disposable.
* it must have a quick startup
* ease the horizontal scalability
* it must ensure a clean shutdown
* stop listening on the port
* finish to handle the current request
* usage of a queueing system for long lasting (worker type) process
## What does that mean for our application ?
Our application exposes HTTP endPoints that are easy and quick to handle. If we were to have some long lasting worker processes, the usage of a queueing system, like Apache Kafka, would be a great choice.
Kafka stores indexes of events processed by each worker. When a worker is restared, it can provide an index indicating at which point in time it needs to restart the event handling. Doing so no events are lost.
[Docker Store](https://store.docker.com) offers several image of Kafka ([Spotify](https://store.docker.com/community/images/spotify/kafka), [Wurstmeister](https://store.docker.com/community/images/wurstmeister/kafka), ...) that can easily be integrated in the docker-compose file of the application.
Below is an example of how Kafka (and zookeeper) could be added to our docker-compose file. Of course, this means the application has been slightly changed to be able to write and read to/from Kafka.
```
# Kafka message broker
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
links:
- zookeeper:zk
environment:
KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100
KAFKA_CREATE_TOPICS: "DATA:1:1"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
```
[Previous](08_concurrency.md) - [Next](10_dev_prod_parity.md)
================================================
FILE: Docker/12factor/10_dev_prod_parity.md
================================================
# 10 - Dev / Prod parity
The different environments must be as close as possible.
Docker is very good at reducing the gap as the same services can be deployed on the developer machine as they could on any Docker Hosts.
A lot of external services are available on the Docker Store and can be used in an existing application. Using those components enables a developer to use Postgres in development instead of SQLite or other lighter alternative. This reduces the risk of small differences that could show up later, when the app is on production.
This factor shows an orientation toward continuous deployment, where development can go from dev to production in a very short timeframe, thus avoiding the big bang effect at each release.
## What does that mean for our application ?
The docker-compose file we built so far can be ran on the local machine or on any Docker Host. So Docker really shines at this level as it handles everything for us.
The exact same application can run on each environment.
[Previous](09_disposability.md) - [Next](11_logs.md)
================================================
FILE: Docker/12factor/11_logs.md
================================================
# 11 - Logs
Logs need to be handle as a timeseries of textual events
The application should not handle or save logs locally but must write them in stdout / stderr.
A lot of services offer a centralized log management ([Elastic Stack / ELK](https://www.elastic.co/products) , [Splunk](http://splunk.com), [Logentries](https://logentries.com), ...), and most of them are very easily integrated with Docker.
Example of Logentries dashboard:

## What does that mean for our application ?
In order to centralize the logs, we can add a **log** service in our docker-compose file. The API token (provided by logentries) needs to be added to the service.
As we can see in the volume section, the Docker socket needs to be mounted so logentries container can retrieve each logs emitted by the running containers and send them to logentries external service.
```
log:
command: '-t XXXXXX-XXXXX-XXXXX-XXXXX'
image: 'logentries/docker-logentries’
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
```
[Previous](10_dev_prod_parity.md) - [Next](12_admin_processes.md)
================================================
FILE: Docker/12factor/12_admin_processes.md
================================================
# 12 - Admin processes
Admin process should be seen as a one-off process (opposed to long running processes that make up an application).
Usually used for maintenance task, though a REPL, admin process must be executed on the same release (codebase + configuration) than the application.
## What does that mean for our application ?
In the docker-compose file we could define an admin service that is ran at the same time as the application and in which we could jump (`docker exec -ti ADMIN_CONTAINER_ID bash`) to execute some admin tasks. The container is able to access all the other containers of the application (provided it belongs to the same networks)
[Previous](11_logs.md)
================================================
FILE: Docker/12factor/README.md
================================================
# 12 Factor Application
Today, a lot of applications are services deployed in the cloud, on infrastructure of cloud providers such as Amazon AWS, Google Compute Engine, DigitalOcean, Rackspace, OVH, ...
Heroku is PaaS (Platform as a Service) that relies on Amazon AWS and which makes the deployment of applications as easy as `git push heroku master` (ran from the root of your application).
With the huge number of applications deployed on Heroku, engineers of the company acquired a great knowledge of what should be done to get cloud native application.
12 factor methodology is the result of their observations. As the name states, it presents 12 principles that will help application to be cloud ready, horizontally scalable, and portable.
# Organisation of this lab
In this lab, we will start by building a simple Node.js application as an HTTP Rest API exposing CRUD (Create / Read / Update / Delete) verbs on a *message* model.
HTTP verb | URI | Action
----------| --- | ------
GET | /message | list all messages
GET | /message/ID | get message with ID
POST | /message | create a message user
PUT | /message/ID | modify message with ID
DELETE | /message/ID | delete message with ID
We will then follow each one of the 12 factor and see how this can leverage our application. At the same time, we will see that Docker is a really great fit for several of those factors.
# Let's get started !
[Build the application](00_application.md)
[1 - Codebase](01_codebase.md)
[2 - Dependencies](02_dependencies.md)
[3 - Configuration](03_configuration.md)
[4 - External services](04_external_services.md)
[5 - Build / Release / Run](05_build_release_run.md)
[6 - Processes](06_processes.md)
[7 - Port binding](07_port_binding.md)
[8 - Concurrency](08_concurrency.md)
[9 - Disposability](09_disposability.md)
[10 - Dev / Prod parity](10_dev_prod_parity.md)
[11 - Logs](11_logs.md)
[12 - Admin processes](12_admin_processes.md)
Do not hesitate to provide comments / feedback you may have in order to improve this lab.
================================================
FILE: Docker/Docker-Orchestration/readme.md
================================================
## Advanced Docker Orchestration by Jérôme Petazzoni
- [Slides](https://jpetazzo.github.io/orchestration-workshop)
- [Orchestration Workshop](https://github.com/docker/orchestration-workshop)
## Workshop Outline
- Pre-requirements
- VM environment
- Our sample application
- Running the application
- Container port mapping
- Identifying bottlenecks
- Scaling HTTP on a single node
- Put a load balancer on it
- Connecting to containers on other hosts
- Abstracting remote services with ambassadors
- Various considerations about ambassadors
- Docker for ops
- Backups
- Starting more containers from your container
- Docker events stream
- Attaching labels
- Logs
- Storing container logs in an ELK stack
- Security upgrades
- Network traffic analysis
- Dynamic orchestration
- Hands-on Swarm
- Deploying Swarm
- Cluster discovery
- Resource allocation
- Connecting containers with ambassadors
- Setting up Consul and overlay networks
- Multi-host networking
- Building images with Swarm
- Deploying a local registry
- Scaling workers
- Distributing Machine credentials
- Highly available Swarm managers
- Highly available containers
- Conclusions
================================================
FILE: Docker/README.md
================================================
# Container, Cloud & DevOps Tutorials and Labs
This repo contains [Docker](https://docker.com) labs and tutorials authored both by Docker and by members of the community. We welcome contributions and want to grow the repo.
#### Docker Tutorials:
- [Docker Kickstart](kickstart/readme.md)
- [Docker Training DevOpsDays](DevOpsDays/readme.md)
- [Docker Swarm Mode](swarm-mode/README.md)
- [Docker Security](security/README.md)
- [Docker Networking](networking/)
#### Additional Docker Labs
Be sure to check out the additional Docker resources section aimed at Developers.
- [Docker Additional Resources](additional-ressources/)
#### Contributing
We want to see this repo grow, so if you have a tutorial to submit or contributions to existing tutorials, please see this guide:
[Guide to submitting your tutorial](./../contribute.md)
================================================
FILE: Docker/additional-ressources/README.md
================================================
# Additional Docker Ressources
This repo contains [Docker](https://docker.com) labs and tutorials, useful links, newsletters, and general Docker ressources. We welcome contributions and want to grow the repo.
#### Useful Links
* [Awesome Docker](http://veggiemonk.github.io/awesome-docker/)
* [Docker Documentation](http://docs.docker.com)
* [Docker Labs](https://github.com/docker/labs)
* [Play-with-Docker](https://labs.play-with-docker.com)
* [More Hands-On Docker Training](http://training.play-with-docker.com/alacart/)
#### Newsletters
* [Docker Newsletter](http://email.docker.com/ZJI6a09YT0000w0vp30KLFC)
* [5 for Friday](http://brianchristner.us3.list-manage.com/track/click?u=fc0e7be4fb674995b89251efb&id=7205e15ac9&e=f62a500248)
* [The New Stack](https://thenewstack.io)
* [Sysdig](https://sysdig.com/blog)
* []
#### Useful Projects
* [Brian Christner](www.github.com/vegasbrianc/prometheus)
* [Cloud Native Foundation](https://www.cncf.io)
* [Jess Frazzle](https://github.com/jessfraz/dockerfiles)
* [Prometheus](prometheus.io)
* [Traefik Proxy](https://traefik.io)
*
#### Docker Tutorials:
* [Configuring developer tools and programming languages](developer-tools/README.md)
* Java
* [Live Debugging Java with Docker](developer-tools/java-debugging)
* [Docker for Java Developers](developer-tools/java/)
* Node.js
* [Live Debugging a Node.js application in Docker](developer-tools/nodejs-debugging)
* [Dockerizing a Node.js application](developer-tools/nodejs/porting/)
* [Docker for ASP.NET and Windows containers](windows/readme.md)
* [Building a 12 Factor app with Docker](12factor/README.md)
* [Hands-on Labs from DockerCon US 2017](dockercon-us-2017/)
================================================
FILE: Docker/additional-ressources/developer-tools/README.md
================================================
# Developer Tools Tutorials
This directory contains tutorials on how to set-up and use common developer tools and programming languages with Docker. We encourage you to [contribute](../contribute.md) your own tutorials here.
## IDEs
With the introduction of [Docker for Mac](https://www.docker.com/products/docker#/mac) and [Docker for Windows](https://www.docker.com/products/docker#/windows), developers on those platforms got to use a feature that developers on [Docker for Linux](https://www.docker.com/products/docker#linux) had all along: in-container development. With improvements in volume management, Docker is able to detect when code in a volume changes, and update the code in the container. That means you get features like live debugging in a running container, without having to rebuild the container.
You can also have all your dependencies in a container. All you need is Docker and something to edit your source files on your machine, and you're good to go. That means you can, for instance, debug Node.js in your container without having Node.js on your local machine.
In order to take advantage of this feature in an IDE, there is some set-up required as there is for any project. The following sections describe how to configure different languages and IDEs to do in-container development.
### [Java Developer Tools](https://github.com/docker/labs/tree/master/developer-tools/java-debugging) including:
+ Eclipse
+ IntelliJ
+ Netbeans
### [Node.js Developer Tools](https://github.com/docker/labs/blob/master/developer-tools/nodejs-debugging/README.md) including:
+ Visual Studio Code
## Programming languages
This is a more comprehensive section detailing how to set-up and optimize your experience using Docker with particular programming languages.
+ [Java](java/)
+ [Node.js](nodejs/porting/)
================================================
FILE: Docker/additional-ressources/developer-tools/README_es.md
================================================
# Tutoriales de Herramientas de Desarrollo
Este directorio contiene tutoriales sobre como configurar y usar herramientas de desarrollo comunes con docker. Te animamos a [contribuir](../contribute.md) con tus propios tutoriales aquí.
## IDEs
Con la introducción de [Docker for Mac](https://www.docker.com/products/docker#/mac) y [Docker for Windows](https://www.docker.com/products/docker#/windows), los desarrolladores pueden ahora desarrollar dentro del contenedor de la misma manera que lo hacen los usuarios que utilizan [Docker for Linux](https://www.docker.com/products/docker#linux). Con mejoras en la administración de volúmenes, Docker permite detectar cuando el código en los volúmenes cambia, y actualizar el código en el contenedor. Esto significa que ahora es posible depurar un contenedor en vivo que se encuentra en ejecución, sin tener que reconstruir el contenedor.
### [Herramientas de Desarrollo Java](https://github.com/docker/labs/tree/master/developer-tools/java-debugging) incluye:
+ Eclipse
+ IntelliJ
+ Netbeans
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/appa-common-commands.adoc
================================================
[appendix]
[[Common_Docker_Commands]]
== Common Docker Commands
Here is the list of commonly used Docker commands:
[width="100%", options="header"]
|==================
| Purpose| Command
2+^s| Image
| Build an image| `docker image build --rm=true .`
| Install an image | `docker image pull ${IMAGE}`
| List of installed images | `docker image ls`
| List of installed images (detailed listing) | `docker image ls --no-trunc`
| Remove an image | `docker image rm ${IMAGE_ID}`
| Remove unused images | `docker image prune`
| Remove all images | `docker image rm $(docker image ls -aq)`
2+^s| Containers
| Run a container | `docker container run`
| List of running containers | `docker container ls`
| List of all containers | `docker container ls -a`
| Stop a container | `docker container stop ${CID}`
| Stop all running containers | `docker container stop $(docker container ls -q)`
| List all exited containers with status 1 | `docker container ls -a --filter "exited=1"`
| Remove a container | `docker container rm ${CID}`
| Remove container by a regular expression | `docker container ls -a \| grep wildfly \| awk '{print $1}' \| xargs docker container rm -f`
| Remove all exited containers | `docker container rm -f $(docker container ls -a \| grep Exit \| awk '{ print $1 }')`
| Remove all containers | `docker container rm $(docker container ls -aq)`
| Find IP address of the container | `docker container inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}`
| Attach to a container | `docker container attach ${CID}`
| Open a shell in to a container | `docker container exec -it ${CID} bash`
| Get container id for an image by a regular expression | `docker container ls \| grep wildfly \| awk '{print $1}'`
|==================
=== Exit code status
The exit code from `docker run` gives information about why the container failed to run or why it exited. The complete list of code is listed:
https://docs.docker.com/engine/reference/run/#exit-status
All other codes are the exit code of the command running in the container.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/appb-troubleshooting.adoc
================================================
[appendix]
[[Troubleshooting]]
== Troubleshooting Docker
=== Network Timed Out
Depending upon the network speed and restrictions, you may not be able to download Docker images from Docker Store. The error message may look like:
```console
$ docker pull arungupta/wildfly-mysql-javaee7
Using default tag: latest
Pulling repository docker.io/arungupta/wildfly-mysql-javaee7
Network timed out while trying to connect to https://index.docker.io/v1/repositories/arungupta/wildfly-mysql-javaee7/images. You may want to check your internet connection or if you are behind a proxy.
```
This section provide a couple of alternatives to solve this.
==== Restart Docker Machine
It seems like Docker Machine gets into a strange state and restarting it fixes that.
```console
docker-machine restart
eval $(docker-machine env )
```
=== Cannot create Docker Machine on Windows
Are you not able to create Docker Machine on Windows?
Try starting a `cmd` with Administrator privileges and then give the command again.
=== Docker machine creation fails with an error about dial tcp: i/o timeout
If you get the following error when creating a docker machine
[source, text]
----
Error creating machine: Error in driver during machine creation: Get https://api.github.com/repos/boot2docker/boot2docker/releases: dial tcp: i/o timeout
----
Then you need to go to the boot2docker releases page on
https://github.com/boot2docker/boot2docker/releases
And download the latest .iso
After that you can move that iso to the docker cache directory. This is located in `~/.docker/machine/cache` on Mac & Linux and `/Users/yourUserName/.docker/machine/cache` on Windows.
Issue: https://github.com/docker/machine/issues/2186 is raised so that the docker-machine team can hopefully find a way around this.
=== "`You may be getting rate limited by Github`" error message
Credits: https://github.com/docker/machine/blob/master/README.md#troubleshooting
In order to `create` or `upgrade` virtual machines running Docker, Docker
Machine will check the Github API for the latest release of the [boot2docker
operating system](https://github.com/boot2docker/boot2docker). The Github API
allows for a small number of unauthenticated requests from a given client, but
if you share an IP address with many other users (e.g. in an office), you may
get rate limited by their API, and Docker Machine will error out with messages
indicating this.
In order to work around this issue, you can https://help.github.com/articles/creating-an-access-token-for-command-line-use/[generate a
token] and pass it to Docker Machine using the global `--github-api-token` flag:
```console
$ docker-machine --github-api-token=token create -d virtualbox newbox
```
This should eliminate any issues you've been experiencing with rate limiting.
=== Docker Machine Troubleshooting
https://github.com/docker/machine/blob/master/README.md#troubleshooting[Docker Machine Troubleshooting] section has good tips on what can possibly go wrong with Docker Machine. Look there if your issue is not explained here.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/appc-references.adoc
================================================
[appendix]
[[References]]
== References
. Docker Docs: http://docs.docker.com
. Latest lab content: https://github.com/docker/labs/tree/master/developer-tools/java
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch01-setup.adoc
================================================
:toc:
:imagesdir: images
= Setup Environments
This section describes the hardware and software needed for this workshop, and how to configure them. This workshop is designed for a BYOL (Brying Your Own Laptop) style hands-on-lab.
== Hardware & Software
. Memory: At least 4 GB+, strongly preferred 8 GB
. Operating System: Mac OS X (10.10.3+), Windows 10 Pro+ 64-bit, Ubuntu 12+, CentOS 7+.
+
NOTE: An older version of the operating system may be used. The installation instructions would differ slightly in that case and are explained in the next section.
. Amazon Web Services credentials with the https://docs.docker.com/docker-for-aws/iam-permissions/[following permissions]. This is only needed for some parts of the workshop.
== Install Docker
Docker runs natively on Mac, Windows and Linux. This lab will use https://www.docker.com/community-edition[Docker Community Edition (CE)]. Download the Docker CE edition for your machine from the https://store.docker.com/search?type=edition&offering=community[Docker Store].
NOTE: Docker CE requires a fairly recent operating system version. If your machine does not meet the requirements, then you need to install https://www.docker.com/products/docker-toolbox[Docker Toolbox].
This workshop is tested with Docker Community Edition `17.09.0-ce-rc2, build 363a3e7` on Mac OS X `10.12.5`.
== Download Images
This tutorial uses a few Docker images and software. Let's download them before we start the tutorial.
Download the file from https://raw.githubusercontent.com/docker/labs/master/developer-tools/java/scripts/docker-compose-pull-images.yml and use the following command to pull the required images:
docker-compose -f docker-compose-pull-images.yml pull --parallel
NOTE: For Linux, `docker-compose` and `docker` commands need `sudo` access. So prefix all commands with `sudo`.
== Other Software
The software in this section is specific to certain parts of the workshop. Install them only if you plan to attempt them.
. Install https://git-scm.com//[git].
. Install Docker Cloud CLI following the https://docs.docker.com/docker-cloud/installing-cli/[instructions].
. Download Java IDE based upon your choice and install.
.. https://netbeans.org/downloads/[NetBeans 8.2] (`"Java SE"` version)
.. https://www.jetbrains.com/idea/download/[IntelliJ IDEA Community or Ultimate]
.. http://www.eclipse.org/downloads/eclipse-packages/[Eclipse IDE for Java EE Developers]
. Download https://maven.apache.org/download.cgi[Maven] and install.
. Download the OpenJDK build of http://download.java.net/java/GA/jdk9/9/binaries/openjdk-9_linux-x64_bin.tar.gz[JDK 9 for Linux x64].
(See also the http://jdk.java.net/9/[OpenJDK JDK 9 download page].)
. Download the early-access Open JDK build of http://jdk.java.net/9/ea[JDK 9 for Alpine Linux].
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch02-basic-concepts.adoc
================================================
:toc:
:imagesdir: images
[[Docker_Basics]]
= Docker Basic Concepts
*PURPOSE*: This chapter introduces the basic terminology of Docker.
[quote, docs.docker.com/]
Docker is a platform for developers and sysadmins to build, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you test and deploy your code into production as fast as possible.
Docker simplifies software delivery by making it easy to build and share images that contain your application’s entire environment, or _application operating system_.
**What does it mean by an application operating system ?**
Your application typically requires specific versions for your operating system, application server, JDK, and database server, may require to tune the configuration files, and similarly multiple other dependencies. The application may need binding to specific ports and certain amount of memory. The components and configuration together required to run your application is what is referred to as application operating system.
You can certainly provide an installation script that will download and install these components. Docker simplifies this process by allowing to create an image that contains your application and infrastructure together, managed as one component. These images are then used to create Docker containers which run on the container virtualization platform, provided by Docker.
== Main Components
Docker has three main components:
. __Images__ are the *build component* of Docker and are the read-only templates defining an application operating system.
. __Containers__ are the *run component* of Docker and created from images. Containers can be run, started, stopped, moved, and deleted.
. Images are stored, shared, and managed in a __registry__ and are the *distribution component* of Docker. Docker Store is a publicly available registry and is available at http://store.docker.com.
In order for these three components to work together, the *Docker Daemon* (or Docker Engine) runs on a host machine and does the heavy lifting of building, running, and distributing Docker containers. In addition, the *Client* is a Docker binary which accepts commands from the user and communicates back and forth with the Engine.
.Docker architecture
image::docker-architecture.png[]
The Client communicates with the Engine that is either co-located on the same host or on a different host. Client uses the `pull` command to request the Engine to pull an image from the registry. The Engine then downloads the image from Docker Store, or whichever registry is configured. Multiple images can be downloaded from the registry and installed on the Engine. Client uses the `run` run the container.
== Docker Image
We've already seen that Docker images are read-only templates from which Docker containers are launched. Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. Union file systems allow files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.
One of the reasons Docker is so lightweight is because of these layers. When you change a Docker image—for example, update an application to a new version— a new layer gets built. Thus, rather than replacing the whole image or entirely rebuilding, as you may do with a virtual machine, only that layer is added or updated. Now you don't need to distribute a whole new image, just the update, making distributing Docker images faster and simpler.
Every image starts from a base image, for example `ubuntu`, a base Ubuntu image, or `fedora`, a base Fedora image. You can also use images of your own as the basis for a new image, for example if you have a base Apache image you could use this as the base of all your web application images.
NOTE: By default, Docker obtains these base images from Docker Store.
Docker images are then built from these base images using a simple, descriptive set of steps we call instructions. Each instruction creates a new layer in our image. Instructions include actions like:
. Run a command
. Add a file or directory
. Create an environment variable
. Run a process when launching a container
These instructions are stored in a file called a Dockerfile. Docker reads this Dockerfile when you request a build of an image, executes the instructions, and returns a final image.
== Docker Container
A container consists of an operating system, user-added files, and meta-data. As we've seen, each container is built from an image. That image tells Docker what the container holds, what process to run when the container is launched, and a variety of other configuration data. The Docker image is read-only. When Docker runs a container from an image, it adds a read-write layer on top of the image (using a union file system as we saw earlier) in which your application can then run.
== Docker Engine
Docker Host is created as part of installing Docker on your machine. Once your Docker host has been created, it then allows you to manage images and containers. For example, the image can be downloaded and containers can be started, stopped and restarted.
== Docker Client
The client communicates with the Docker Host and let's you work with images and containers.
Check if your client is working using the following command:
docker -v
It shows the output:
Docker version 17.09.0-ce-rc3, build 2357fb2
NOTE: The exact version may differ based upon how recently the installation was performed.
The exact version of Client and Server can be seen using `docker version` command. This shows the output as:
```
Client:
Version: 17.09.0-ce-rc3
API version: 1.32
Go version: go1.8.3
Git commit: 2357fb2
Built: Thu Sep 21 02:31:18 2017
OS/Arch: darwin/amd64
Server:
Version: 17.09.0-ce-rc3
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: 2357fb2
Built: Thu Sep 21 02:36:52 2017
OS/Arch: linux/amd64
Experimental: true
```
The complete set of commands can be seen using `docker --help`.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch03-build-image-java-9.adoc
================================================
:toc:
:imagesdir: images
= Build a Docker Image with JDK 9
*PURPOSE*: This chapter explains how to create a Docker image with JDK 9.
The link:ch03-build-image.adoc[prior chapter] explained how, in general, to build a Docker image with Java.
This chapter expands on this topic and focuses on JDK 9 features.
== Create a Docker Image using JDK 9
Create a new directory, for example `docker-jdk9`.
In that directory, create a new text file `jdk-9-debian-slim.Dockerfile`.
Use the following contents:
[source, text]
----
# A JDK 9 with Debian slim
FROM debian:stable-slim
# Download from http://jdk.java.net/9/
# ADD http://download.java.net/java/GA/jdk9/9/binaries/openjdk-9_linux-x64_bin.tar.gz /opt
ADD openjdk-9_linux-x64_bin.tar.gz /opt
# Set up env variables
ENV JAVA_HOME=/opt/jdk-9
ENV PATH=$PATH:$JAVA_HOME/bin
CMD ["jshell", "-J-XX:+UnlockExperimentalVMOptions", \
"-J-XX:+UseCGroupMemoryLimitForHeap", \
"-R-XX:+UnlockExperimentalVMOptions", \
"-R-XX:+UseCGroupMemoryLimitForHeap"]
----
This image uses `debian` slim as the base image and installs the OpenJDK build
of JDK for linux x64 (see the link:ch01-setup.adoc[setup section] for how to download this into the
current directory).
The image is configured by default to run `jshell` the Java REPL. Read more JShell at link:https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm[Introduction to JShell]. The
experimental flag `-XX:+UseCGroupMemoryLimitForHeap` is passed to the REPL
process (the frontend Java process managing user input and the backend Java
process managing compilation). This option will ensure container memory
constraints are honored.
Build the image using the command:
docker image build -t jdk-9-debian-slim -f jdk-9-debian-slim.Dockerfile .
List the images available using `docker image ls`:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
jdk-9-debian-slim latest 023f6999d94a 4 hours ago 400MB
debian stable-slim d30525fb4ed2 4 days ago 55.3MB
----
Other images may be shown as well but we are interested in these two images for
now. The large difference in size is attributed to JDK 9, which is larger
in size than JDK 8 because it also explicitly provides Java modules that we
shall see more of later on in this chapter.
Run the container using the command:
docker container run -m=200M -it --rm jdk-9-debian-slim
to see the output:
[source, text]
----
INFO: Created user preferences directory.
| Welcome to JShell -- Version 9
| For an introduction type: /help intro
jshell>
----
Query the available memory of the Java process by typing the following
expression into the Java REPL:
Runtime.getRuntime().maxMemory() / (1 << 20)
to see the output:
[source, text]
----
jshell> Runtime.getRuntime().maxMemory() / (1 << 20)
$1 ==> 100
----
Notice that the Java process is honoring memory constraints (see the `--memory`
of `docker container run`) and will not allocate memory beyond that specified for the
container.
In a future release of the JDK it will no longer be necessary to specify an
experimental flag (`-XX:+UnlockExperimentalVMOptions`) once the mechanism by
which memory constraints are efficiently detected is stable.
JDK 9 supports the set CPUs constraint (see the `--cpuset-cpus` of
`docker container run`) but does not currently support other CPU constraints such as
CPU shares. This is ongoing work http://openjdk.java.net/jeps/8182070[tracked]
in the OpenJDK project.
Note: the support for CPU sets and memory constraints have also been backported
to JDK 8 release 8u131 and above.
Type `Ctrl` + `D` to exit out of `jshell`.
To list all the Java modules distributed with JDK 9 run the following command:
docker container run -m=200M -it --rm jdk-9-debian-slim java --list-modules
This will show an output:
[source, text]
----
java.activation@9
java.base@9
java.compiler@9
java.corba@9
java.datatransfer@9
java.desktop@9
java.instrument@9
java.logging@9
java.management@9
java.management.rmi@9
java.naming@9
java.prefs@9
java.rmi@9
java.scripting@9
java.se@9
java.se.ee@9
java.security.jgss@9
java.security.sasl@9
java.smartcardio@9
java.sql@9
java.sql.rowset@9
java.transaction@9
java.xml@9
java.xml.bind@9
java.xml.crypto@9
java.xml.ws@9
java.xml.ws.annotation@9
jdk.accessibility@9
jdk.aot@9
jdk.attach@9
jdk.charsets@9
jdk.compiler@9
jdk.crypto.cryptoki@9
jdk.crypto.ec@9
jdk.dynalink@9
jdk.editpad@9
jdk.hotspot.agent@9
jdk.httpserver@9
jdk.incubator.httpclient@9
jdk.internal.ed@9
jdk.internal.jvmstat@9
jdk.internal.le@9
jdk.internal.opt@9
jdk.internal.vm.ci@9
jdk.internal.vm.compiler@9
jdk.jartool@9
jdk.javadoc@9
jdk.jcmd@9
jdk.jconsole@9
jdk.jdeps@9
jdk.jdi@9
jdk.jdwp.agent@9
jdk.jlink@9
jdk.jshell@9
jdk.jsobject@9
jdk.jstatd@9
jdk.localedata@9
jdk.management@9
jdk.management.agent@9
jdk.naming.dns@9
jdk.naming.rmi@9
jdk.net@9
jdk.pack@9
jdk.policytool@9
jdk.rmic@9
jdk.scripting.nashorn@9
jdk.scripting.nashorn.shell@9
jdk.sctp@9
jdk.security.auth@9
jdk.security.jgss@9
jdk.unsupported@9
jdk.xml.bind@9
jdk.xml.dom@9
jdk.xml.ws@9
jdk.zipfs@9
----
In total there should be 75 modules:
[source, text]
----
$ docker container run -m=200M -it --rm jdk-9-debian-slim java --list-modules | wc -l
75
----
== Create a Docker Image using JDK 9 and Alpine Linux
Instead of `debian` as the base image it is possible to use Alpine Linux
with an early access build of JDK 9 that is compatible with the muslc library
shipped with Alpine Linux.
Create a new text file `jdk-9-alpine.Dockerfile`.
Use the following contents:
[source, text]
----
# A JDK 9 with Alpine Linux
FROM alpine:3.6
# Add the musl-based JDK 9 distribution
RUN mkdir /opt
# Download from http://jdk.java.net/9/
# ADD http://download.java.net/java/jdk9-alpine/archive/181/binaries/jdk-9-ea+181_linux-x64-musl_bin.tar.gz
ADD jdk-9-ea+181_linux-x64-musl_bin.tar.gz /opt
# Set up env variables
ENV JAVA_HOME=/opt/jdk-9
ENV PATH=$PATH:$JAVA_HOME/bin
CMD ["jshell", "-J-XX:+UnlockExperimentalVMOptions", \
"-J-XX:+UseCGroupMemoryLimitForHeap", \
"-R-XX:+UnlockExperimentalVMOptions", \
"-R-XX:+UseCGroupMemoryLimitForHeap"]
----
This image uses `alpine` 3.6 as the base image and installs the OpenJDK build
of JDK for Alpine Linux x64 (see the link:ch01-setup.adoc[Setup Environments]
chapter for how to download this into the current directory).
The image is configured in the same manner as for the `debian`-based image.
Build the image using the command:
docker image build -t jdk-9-alpine -f jdk-9-alpine.Dockerfile .
List the images available using `docker image ls`:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
jdk-9-debian-slim latest 023f6999d94a 4 hours ago 400MB
jdk-9-alpine latest f5a57382f240 4 hours ago 356MB
debian stable-slim d30525fb4ed2 4 days ago 55.3MB
alpine 3.6 7328f6f8b418 3 months ago 3.97MB
----
Notice the difference in image sizes. Alpine Linux by design has been carefully
crafted to produce a minimal running OS image. A cost of such a design is
an alternative standard library https://www.musl-libc.org/[musl libc] that is
not compatible with the C standard library (libc). As a result the JDK requires
modifications to run on Alpine Linux. Such modifications have been proposed
by the OpenJDK http://openjdk.java.net/projects/portola/[Portola Project].
== Create a Docker Image using JDK 9 and a Java application
Clone the GitHib project https://github.com/PaulSandoz/helloworld-java-9 that
contains a simple Java 9-based project:
git clone https://github.com/PaulSandoz/helloworld-java-9.git
(If you have a github account you may wish to fork it and then clone the fork
so you can make modifications.)
Enter the directory `helloworld-java-9` and build the project from within a
running Docker container with JDK 9 installed:
docker container run --volume $PWD:/helloworld-java-9 --workdir /helloworld-java-9 \
-it --rm openjdk:9-jdk-slim \
./mvnw package
(If you have JDK 9 installed locally on the host system you can build directly
with `./mvnw package`.)
In this case we are using the `openjdk:9-jdk-slim` on Docker hub that has been
configured to work with SSL certificates so that the maven wrapper tool can
successfully download the maven tool. This image is not produced or in anyway
endorsed by the OpenJDK project (unlike the JDK 9 distributions that were
previously required). It is anticipated that future releases of the JDK from
the OpenJDK project will have root CA certificates (see issue
https://bugs.openjdk.java.net/browse/JDK-8189131[JDK-8189131])
To build Docker image for this application use the file `helloworld-jdk-9.Dockerfile` from the checked out repo to build your image. The contents of the file are shown below:
[source, text]
----
# Hello world application with JDK 9 and Debian slim
FROM jdk-9-debian-slim
COPY target/helloworld-1.0-SNAPSHOT.jar /opt/helloworld/helloworld-1.0-SNAPSHOT.jar
# Set up env variables
CMD java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap \
-cp /opt/helloworld/helloworld-1.0-SNAPSHOT.jar org.examples.java.App
----
Build a Docker image containing the simple Java application based of the Docker
image `jdk-9-debian-slim`:
docker image build -t helloworld-jdk-9 -f helloworld-jdk-9.Dockerfile .
List the images available using `docker image ls`:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
helloworld-jdk-9 latest eb0539e9529a 19 seconds ago 400MB
jdk-9-debian-slim latest 023f6999d94a 5 hours ago 400MB
jdk-9-alpine latest f5a57382f240 5 hours ago 356MB
openjdk 9-jdk-slim 6dca67f4790e 3 days ago 372MB
debian stable-slim d30525fb4ed2 4 days ago 55.3MB
alpine 3.6 7328f6f8b418 3 months ago 3.97MB
----
Notice how large the application image `helloworld-jdk-9`.
Run the `jdeps` tool to see what modules the application depends on:
docker container run -it --rm helloworld-jdk-9 jdeps --list-deps /opt/helloworld/helloworld-1.0-SNAPSHOT.jar
and observe that the application only depends on the `java.base` module.
== Reduce the size of a Docker Image using JDK 9 and a Java application
The Java application is extremely simple and as a result uses very little of the
functionality shipped with JDK 9 distribution, specifically the application
only depends on functionality present in the `java.base` module. We can create
a custom Java runtime that only contains the `java.base` module and include
that in application Docker image.
Create a custom Java runtime that is small and only contains the `java.base`
module:
docker container run --rm \
--volume $PWD:/out \
jdk-9-debian-slim \
jlink --module-path /opt/jdk-9/jmods \
--verbose \
--add-modules java.base \
--compress 2 \
--no-header-files \
--output /out/target/openjdk-9-base_linux-x64
This command exists as `create-minimal-java-runtime.sh` script in the repo earlier checked out from link:https://github.com/PaulSandoz/helloworld-java-9[helloworld-java-9].
The JDK 9 tool `jlink` is used to create the custom Java runtime. Read more jlink in the https://docs.oracle.com/javase/9/tools/jlink.htm[Tools Reference]. The tool
is executed from with the container containing JDK 9 and directory where the
modules reside, `/opt/jdk-9/jmods`, is declared in the module path. Only the
`java.base` module is selected.
The custom runtime is output to the `target` directory:
[source, text]
----
$ du -k target/openjdk-9-base_linux-x64/
24 target/openjdk-9-base_linux-x64//bin
12 target/openjdk-9-base_linux-x64//conf/security/policy/limited
8 target/openjdk-9-base_linux-x64//conf/security/policy/unlimited
24 target/openjdk-9-base_linux-x64//conf/security/policy
68 target/openjdk-9-base_linux-x64//conf/security
76 target/openjdk-9-base_linux-x64//conf
44 target/openjdk-9-base_linux-x64//legal/java.base
44 target/openjdk-9-base_linux-x64//legal
72 target/openjdk-9-base_linux-x64//lib/jli
16 target/openjdk-9-base_linux-x64//lib/security
19824 target/openjdk-9-base_linux-x64//lib/server
31656 target/openjdk-9-base_linux-x64//lib
31804 target/openjdk-9-base_linux-x64/
----
To build Docker image for this application use the file `helloworld-jdk-9-base.Dockerfile` from the checked out repo. The contents of the file are shown below:
[source, text]
----
# Hello world application with custom Java runtime with just the base module and Debian slim
FROM debian:stable-slim
COPY target/openjdk-9-base_linux-x64 /opt/jdk-9
COPY target/helloworld-1.0-SNAPSHOT.jar /opt/helloworld/helloworld-1.0-SNAPSHOT.jar
# Set up env variables
ENV JAVA_HOME=/opt/jdk-9
ENV PATH=$PATH:$JAVA_HOME/bin
CMD java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap \
-cp /opt/helloworld/helloworld-1.0-SNAPSHOT.jar org.examples.java.App
----
Build a Docker image containing the simple Java application based of the Docker
image `debian:stable-slim`:
docker image build -t helloworld-jdk-9-base -f helloworld-jdk-9-base.Dockerfile .
List the images available using `docker image ls`:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
helloworld-jdk-9-base latest 7052483fdb77 24 seconds ago 87.7MB
helloworld-jdk9 latest eb0539e9529a 17 minutes ago 400MB
jdk-9-debian-slim latest 023f6999d94a 5 hours ago 400MB
jdk-9-alpine latest f5a57382f240 5 hours ago 356MB
openjdk 9-jdk-slim 6dca67f4790e 3 days ago 372MB
debian stable-slim d30525fb4ed2 4 days ago 55.3MB
alpine 3.6 7328f6f8b418 3 months ago 3.97MB
[source, text]
----
The `helloworld-jdk-9-base` is much smaller and could be reduced further if
Alpine Linux was used instead of Debian Slim.
A realistic application will depend on more JDK modules but it's still possible
to significantly reduce the Java runtime to only the required modules (for
example many applications will not require Corba or RMI nor the compiler tools).
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch03-build-image.adoc
================================================
:toc:
:imagesdir: images
= Build a Docker Image
*PURPOSE*: This chapter explains how to create a Docker image.
== Dockerfile
Docker build images by reading instructions from a _Dockerfile_. A _Dockerfile_ is a text document that contains all the commands a user could call on the command line to assemble an image. `docker image build` command uses this file and executes all the commands in succession to create an image.
`build` command is also passed a context that is used during image creation. This context can be a path on your local filesystem or a URL to a Git repository.
_Dockerfile_ is usually called _Dockerfile_. The complete list of commands that can be specified in this file are explained at https://docs.docker.com/reference/builder/. The common commands are listed below:
.Common commands for Dockerfile
[width="100%", options="header", cols="1,4,4"]
|==================
| Command | Purpose | Example
| FROM | First non-comment instruction in _Dockerfile_ | `FROM ubuntu`
| COPY | Copies mulitple source files from the context to the file system of the container at the specified path | `COPY .bash_profile /home`
| ENV | Sets the environment variable | `ENV HOSTNAME=test`
| RUN | Executes a command | `RUN apt-get update`
| CMD | Defaults for an executing container | `CMD ["/bin/echo", "hello world"]`
| EXPOSE | Informs the network ports that the container will listen on | `EXPOSE 8093`
|==================
== Create your first image
Create a new directory `hellodocker`.
In that directory, create a new text file `Dockerfile`. Use the following contents:
[source, text]
----
FROM ubuntu:latest
CMD ["/bin/echo", "hello world"]
----
This image uses `ubuntu` as the base image. `CMD` command defines the command that needs to run. It provides a different entry point of `/bin/echo` and gives the argument "`hello world`".
Build the image using the command:
[source, text]
----
docker image build . -t helloworld
----
`.` in this command is the context for the command `docker image build`. `-t` adds a tag to the image.
The following output is shown:
[source, text]
----
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM ubuntu:latest
latest: Pulling from library/ubuntu
9fb6c798fa41: Pull complete
3b61febd4aef: Pull complete
9d99b9777eb0: Pull complete
d010c8cf75d7: Pull complete
7fac07fb303e: Pull complete
Digest: sha256:31371c117d65387be2640b8254464102c36c4e23d2abe1f6f4667e47716483f1
Status: Downloaded newer image for ubuntu:latest
---> 2d696327ab2e
Step 2/2 : CMD /bin/echo hello world
---> Running in 9356a508590c
---> e61f88f3a0f7
Removing intermediate container 9356a508590c
Successfully built e61f88f3a0f7
Successfully tagged helloworld:latest
----
List the images available using `docker image ls`:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
helloworld latest e61f88f3a0f7 3 minutes ago 122MB
ubuntu latest 2d696327ab2e 4 days ago 122MB
----
Other images may be shown as well but we are interested in these two images for now.
Run the container using the command:
docker container run helloworld
to see the output:
hello world
If you do not see the expected output, check your Dockerfile that the content exactly matches as shown above. Build the image again and now run it.
Change the base image from `ubuntu` to `busybox` in `Dockerfile`. Build the image again:
docker image build -t helloworld:2 .
and view the images using `docker image ls` command:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
helloworld 2 7fbedda27c66 3 seconds ago 1.13MB
helloworld latest e61f88f3a0f7 5 minutes ago 122MB
ubuntu latest 2d696327ab2e 4 days ago 122MB
busybox latest 54511612f1c4 9 days ago 1.13MB
----
`helloworld:2` is the format that allows to specify the image name and assign a tag/version to it separated by `:`.
== Create your first image using Java
=== Create a simple Java application
[NOTE]
====
If you are running OpenJDK 9, `mvn package` may fail with
[source, text]
----
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project helloworld: Compilation failure: Compilation failure:
[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
----
because support for Java 5 http://openjdk.java.net/jeps/182[was dropped in JDK9].
You can add
[source, xml]
----
1.61.6
----
to the generated `pom.xml` to target 1.6 instead. See also the link:chapters/ch03-build-image-java-9.adoc[Build a Docker Image for Java 9] chapter.
====
Create a new Java project:
[source, text]
----
mvn archetype:generate -DgroupId=org.examples.java -DartifactId=helloworld -DinteractiveMode=false
----
Build the project:
[source, text]
----
cd helloworld
mvn package
----
Run the Java class:
[source, text]
----
java -cp target/helloworld-1.0-SNAPSHOT.jar org.examples.java.App
----
This shows the output:
[source, text]
----
Hello World!
----
Let's package this application as a Docker image.
==== Java Docker image
Run the OpenJDK container in an interactive manner:
docker container run -it openjdk
This will open a terminal in the container. Check the version of Java:
[source, text]
----
root@8d0af9da5258:/# java -version
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-1~deb9u1-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)
----
A different JDK version may be shown in your case.
Exit out of the container by typing `exit` in the container shell.
=== Package and run Java application as Docker image
Create a new Dockerfile in `helloworld` directory and use the following content:
[source, text]
----
FROM openjdk:latest
COPY target/helloworld-1.0-SNAPSHOT.jar /usr/src/helloworld-1.0-SNAPSHOT.jar
CMD java -cp /usr/src/helloworld-1.0-SNAPSHOT.jar org.examples.java.App
----
Build the image:
docker image build -t hello-java:latest .
Run the image:
docker container run hello-java:latest
This displays the output:
Hello World!
This shows the exactly same output that was printed when the Java class was invoked using Java CLI.
=== Package and run Java Application using Docker Maven Plugin
https://github.com/fabric8io/docker-maven-plugin[Docker Maven Plugin] allows you to manage Docker images and containers using Maven. It comes with predefined goals:
[options="header"]
|====
|Goal | Description
| `docker:build` | Build images
| `docker:start` | Create and start containers
| `docker:stop` | Stop and destroy containers
| `docker:push` | Push images to a registry
| `docker:remove` | Remove images from local docker host
| `docker:logs` | Show container logs
|====
Complete set of goals are listed at https://github.com/fabric8io/docker-maven-plugin.
Clone the sample code from https://github.com/arun-gupta/docker-java-sample/.
Create the Docker image:
mvn -f docker-java-sample/pom.xml package -Pdocker
This will show an output like:
[source, text]
----
[INFO] Copying files to /Users/argu/workspaces/docker-java-sample/target/docker/hellojava/build/maven
[INFO] Building tar: /Users/argu/workspaces/docker-java-sample/target/docker/hellojava/tmp/docker-build.tar
[INFO] DOCKER> [hellojava:latest]: Created docker-build.tar in 87 milliseconds
[INFO] DOCKER> [hellojava:latest]: Built image sha256:6f815
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
----
The list of images can be checked using the command `docker image ls | grep hello-java`:
[source, text]
----
hello-java latest ea64a9f5011e 5 seconds ago 643 MB
----
Run the Docker container:
mvn -f docker-java-sample/pom.xml install -Pdocker
This will show an output like:
[source, text]
----
[INFO] DOCKER> [hellojava:latest]: Start container 30a08791eedb
30a087> Hello World!
[INFO] DOCKER> [hellojava:latest]: Waited on log out 'Hello World!' 510 ms
----
This is similar output when running the Java application using `java` CLI or the Docker container using `docker container run` command.
The container is running in the foreground. Use `Ctrl` + `C` to interrupt the container and return back to terminal.
Only one change was required in the project to enable Docker packaging and running. A Maven profile is added in `pom.xml`:
[source, text]
----
dockerio.fabric8docker-maven-plugin0.22.1hello-javaopenjdk:latestartifactjava -cp maven/${project.name}-${project.version}.jar org.examples.java.AppHello World!docker:buildpackagebuilddocker:startinstallstartlogs
----
== Dockerfile Command Design Patterns
=== Difference between CMD and ENTRYPOINT
*TL;DR* `CMD` will work for most of the cases.
Default entry point for a container is `/bin/sh`, the default shell.
Running a container as `docker container run -it ubuntu` uses that command and starts the default shell. The output is shown as:
```console
> docker container run -it ubuntu
root@88976ddee107:/#
```
`ENTRYPOINT` allows to override the entry point to some other command, and even customize it. For example, a container can be started as:
```console
> docker container run -it --entrypoint=/bin/cat ubuntu /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
. . .
```
This command overrides the entry point to the container to `/bin/cat`. The argument(s) passed to the CLI are used by the entry point.
=== Difference between ADD and COPY
*TL;DR* `COPY` will work for most of the cases.
`ADD` has all capabilities of `COPY` and has the following additional features:
. Allows tar file auto-extraction in the image, for example, `ADD app.tar.gz /opt/var/myapp`.
. Allows files to be downloaded from a remote URL. However, the downloaded files will become part of the image. This causes the image size to bloat. So its recommended to use `curl` or `wget` to download the archive explicitly, extract, and remove the archive.
=== Import and export images
Docker images can be saved using `image save` command to a `.tar` file:
docker image save helloworld > helloworld.tar
These tar files can then be imported using `load` command:
docker image load -i helloworld.tar
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch04-run-container.adoc
================================================
:toc:
:imagesdir: images
= Run a Docker Container
The first step in running an application using Docker is to run a container. If you can think of an open source software, there is a very high likelihood that there will be a Docker image available for it at https://store.docker.com[Docker Store]. Docker client can simply run the container by giving the image name. The client will check if the image already exists on Docker Host. If it exists then it'll run the container, otherwise the host will first download the image.
== Pull Image
Let's check if any images are available:
[source, text]
----
docker image ls
----
At first, this list is empty. If you've already downloaded the images as specified in the setup chapter, then all the images will be shown here.
List of images can be seen again using the `docker image ls` command. This will show the following output:
[source, text]
----
REPOSITORY TAG IMAGE ID CREATED SIZE
hellojava latest 8d76bf5691c4 32 minutes ago 740MB
hello-java latest 93b1180c5d91 36 minutes ago 740MB
helloworld 2 7fbedda27c66 41 minutes ago 1.13MB
helloworld latest e61f88f3a0f7 About an hour ago 122MB
mysql latest b4e78b89bcf3 3 days ago 412MB
ubuntu latest 2d696327ab2e 4 days ago 122MB
jboss/wildfly latest 9adbdb00cded 8 days ago 592MB
openjdk latest 6077adce18ea 8 days ago 740MB
busybox latest 54511612f1c4 9 days ago 1.13MB
tailtarget/hadoop 2.7.2 ee6b539c886e 6 months ago 1.15GB
tailtarget/jenkins 2.32.3 71a7d9bcfe2b 6 months ago 859MB
arungupta/couchbase travel 7929a80707db 7 months ago 583MB
arungupta/couchbase-javaee travel 2bb52abaad5f 7 months ago 595MB
arungupta/javaee7-hol latest da5c9d4f85ca 2 years ago 582MB
----
More details about the image can be obtained using `docker image history jboss/wildfly` command:
[source, text]
----
IMAGE CREATED CREATED BY SIZE COMMENT
9adbdb00cded 8 days ago /bin/sh -c #(nop) CMD ["/opt/jboss/wildfl... 0B
8 days ago /bin/sh -c #(nop) EXPOSE 8080/tcp 0B
8 days ago /bin/sh -c #(nop) USER [jboss] 0B
8 days ago /bin/sh -c #(nop) ENV LAUNCH_JBOSS_IN_BAC... 0B
8 days ago /bin/sh -c cd $HOME && curl -O https:/... 163MB
8 days ago /bin/sh -c #(nop) USER [root] 0B
8 days ago /bin/sh -c #(nop) ENV JBOSS_HOME=/opt/jbo... 0B
8 days ago /bin/sh -c #(nop) ENV WILDFLY_SHA1=9ee3c0... 0B
8 days ago /bin/sh -c #(nop) ENV WILDFLY_VERSION=10.... 0B
8 days ago /bin/sh -c #(nop) ENV JAVA_HOME=/usr/lib/... 0B
8 days ago /bin/sh -c #(nop) USER [jboss] 0B
8 days ago /bin/sh -c yum -y install java-1.8.0-openj... 204MB
8 days ago /bin/sh -c #(nop) USER [root] 0B
8 days ago /bin/sh -c #(nop) MAINTAINER Marek Goldma... 0B
8 days ago /bin/sh -c #(nop) USER [jboss] 0B
8 days ago /bin/sh -c #(nop) WORKDIR /opt/jboss 0B
8 days ago /bin/sh -c groupadd -r jboss -g 1000 && us... 296kB
8 days ago /bin/sh -c yum update -y && yum -y install... 28.7MB
8 days ago /bin/sh -c #(nop) MAINTAINER Marek Goldma... 0B
8 days ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
8 days ago /bin/sh -c #(nop) LABEL name=CentOS Base ... 0B
8 days ago /bin/sh -c #(nop) ADD file:1ed4d1a29d09a63... 197MB
----
== Run Container
=== Interactively
Run WildFly container in an interactive mode.
[source, text]
----
docker container run -it jboss/wildfly
----
This will show the output as:
[source, text]
----
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/jboss/wildfly
JAVA: /usr/lib/jvm/java/bin/java
. . .
00:26:27,455 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
00:26:27,456 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
00:26:27,457 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 3796ms - Started 331 of 577 services (393 services are lazy, passive or on-demand)
----
This shows that the server started correctly, congratulations!
By default, Docker runs in the foreground. `-i` allows to interact with the STDIN and `-t` attach a TTY to the process. Switches can be combined together and used as `-it`.
Hit Ctrl+C to stop the container.
=== Detached container
Restart the container in detached mode:
[source, text]
----
docker container run -d jboss/wildfly
254418caddb1e260e8489f872f51af4422bc4801d17746967d9777f565714600
----
`-d`, instead of `-it`, runs the container in detached mode.
The output is the unique id assigned to the container. Logs of the container can be seen using the command `docker container logs `, where `` is the id of the container.
Status of the container can be checked using the `docker container ls` command:
[source, text]
----
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
254418caddb1 jboss/wildfly "/opt/jboss/wildfl..." 2 minutes ago Up 2 minutes 8080/tcp gifted_haibt
----
Also try `docker container ls -a` to see all the containers on this machine.
=== With default port
If you want the container to accept incoming connections, you will need to provide special options when invoking `docker run`. The container, we just started, can't be accessed by our browser. We need to stop it again and restart with different options.
[source, text]
----
docker container stop `docker container ps | grep wildfly | awk '{print $1}'`
----
Restart the container as:
[source, text]
----
docker container run -d -P --name wildfly jboss/wildfly
----
`-P` map any exposed ports inside the image to a random port on Docker host. In addition, `--name` option is used to give this container a name. This name can then later be used to get more details about the container or stop it. This can be verified using `docker container ls` command:
[source, text]
----
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
89fbfbceeb56 jboss/wildfly "/opt/jboss/wildfl..." 9 seconds ago Up 8 seconds 0.0.0.0:32768->8080/tcp wildfly
----
The port mapping is shown in the `PORTS` column. Access WildFly server at http://localhost:32768. Make sure to use the correct port number as shown in your case.
NOTE: Exact port number may be different in your case.
The page would look like:
image::wildfly-first-run-default-page.png[]
=== With specified port
Stop and remove the previously running container as:
[source, text]
----
docker container stop wildfly
docker container rm wildfly
----
Alternatively, `docker container rm -f wildfly` can be used to stop and remove the container in one command. Be careful with this command because `-f` uses `SIGKILL` to kill the container.
Restart the container as:
[source, text]
----
docker container run -d -p 8080:8080 --name wildfly jboss/wildfly
----
The format is `-p hostPort:containerPort`. This option maps a port on the host to a port in the container. This allows us to access the container on the specified port on the host.
Now we're ready to test http://localhost:8080. This works with the exposed port, as expected.
Let's stop and remove the container as:
[source, text]
----
docker container stop wildfly
docker container rm wildfly
----
=== Deploy a WAR file to application server
Now that your application server is running, lets see how to deploy a WAR file to it.
Create a new directory `hellojavaee`. Create a new text file and name it `Dockerfile`. Use the following contents:
[source, text]
----
FROM jboss/wildfly:latest
RUN curl -L https://github.com/javaee-samples/javaee7-simple-sample/releases/download/v1.10/javaee7-simple-sample-1.10.war -o /opt/jboss/wildfly/standalone/deployments/javaee-simple-sample.war
----
Create an image:
[source, text]
----
docker image build -t javaee-sample .
----
Start the container:
[source, text]
----
docker container run -d -p 8080:8080 --name wildfly javaee-sample
----
Access the endpoint:
[source, text]
----
curl http://localhost:8080/javaee-simple-sample/resources/persons
----
See the output:
[source, text]
----
Penny
Leonard
Sheldon
Amy
Howard
Bernadette
Raj
Priya
----
Optional: `brew install XML-Coreutils` will install XML formatting utility on Mac. This output can then be piped to `xml-fmt` to display a formatted result.
== Stop container
Stop a specific container by id or name:
[source, text]
----
docker container stop
docker container stop
----
Stop all running containers:
[source, text]
----
docker container stop $(docker container ps -q)
----
Stop only the exited containers:
[source, text]
----
docker container ps -a -f "exited=-1"
----
== Remove container
Remove a specific container by id or name:
[source, text]
----
docker container rm
docker container rm
----
Remove containers meeting a regular expression
[source, text]
----
docker container ps -a | grep wildfly | awk '{print $1}' | xargs docker container rm
----
Remove all containers, without any criteria
[source, text]
----
docker container rm $(docker container ps -aq)
----
== Additional ways to find port mapping
The exact mapped port can also be found using `docker port` command:
[source, text]
----
docker container port or
----
This shows the output as:
[source, text]
----
8080/tcp -> 0.0.0.0:8080
----
Port mapping can be also be found using `docker inspect` command:
[source, text]
----
docker container inspect --format='{{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}}'
----
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch05-compose.adoc
================================================
:toc:
:imagesdir: images
[[Docker_Compose]]
= Multi-container application using Docker Compose
== What is Docker Compose
[quote, github.com/docker/compose]
Docker Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.
An application using Docker containers will typically consist of multiple containers. With Docker Compose, there is no need to write shell scripts to start your containers. All the containers are defined in a configuration file using _services_, and then `docker-compose` script is used to start, stop, and restart the application and all the services in that application, and all the containers within that service. The complete list of commands is:
[options="header"]
|====
| Command | Purpose
| `build` | Build or rebuild services
| `help` | Get help on a command
| `kill` | Kill containers
| `logs` | View output from containers
| `port` | Print the public port for a port binding
| `ps` | List containers
| `pull` | Pulls service images
| `restart` | Restart services
| `rm` | Remove stopped containers
| `run` | Run a one-off command
| `scale` | Set number of containers for a service
| `start` | Start services
| `stop` | Stop services
| `up` | Create and start containers
| `migrate-to-labels Recreate containers to add labels
|====
The application used in this section is a Java EE application talking to a database. The application publishes a REST endpoint that can be invoked using `curl. It is deployed using http://wildfly-swarm.io/[WildFly Swarm] that communicates to MySQL database.
WildFly Swarm and MySQL will be running in two separate containers, and thus making this a multi-container application.
== Configuration file
Th entry point to Docker Compose is a Compose file, usually called `docker-compose.yml`. Create a new directory `javaee`. In that directory, create a new file `docker-compose.yml` in it. Use the following contents:
```
version: '3.3'
services:
db:
container_name: db
image: mysql:8
environment:
MYSQL_DATABASE: employees
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_ROOT_PASSWORD: supersecret
ports:
- 3306:3306
web:
image: arungupta/docker-javaee:dockerconeu17
ports:
- 8080:8080
- 9990:9990
depends_on:
- db
```
In this Compose file:
. Two services in this Compose are defined by the name `db` and `web` attributes
. Image name for each service defined using `image` attribute
. The `mysql:8` image starts the MySQL server.
. `environment` attribute defines environment variables to initialize MySQL server.
.. `MYSQL_DATABASE` allows you to specify the name of a database to be created on image startup.
.. `MYSQL_USER` and `MYSQL_PASSWORD` are used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions for the database specified by the `MYSQL_DATABASE` variable.
.. `MYSQL_ROOT_PASSWORD` is mandatory and specifies the password that will be set for the MySQL root superuser account.
. Java EE application uses the `db` service as specified in the `connection-url` as specified at https://github.com/arun-gupta/docker-javaee/blob/master/employees/src/main/resources/project-defaults.yml/.
. The `arungupta/docker-javaee:dockerconeu17` image starts WildFly Swarm application server. It consists of the Java EE application built from https://github.com/arun-gupta/docker-javaee. Clone that project if you want to build your own image.
. Port forwarding is achieved using `ports` attribute.
. `depends_on` attribute allows to express dependency between services. In this case, MySQL will be started before WildFly. Application-level health check are still user's responsibility.
== Start application
All services in the application can be started, in detached mode, by giving the command:
```
docker-compose up -d
```
An alternate Compose file name can be specified using `-f` option.
An alternate directory where the compose file exists can be specified using `-p` option.
This shows the output as:
```
docker-compose up -d
Creating network "javaee_default" with the default driver
Creating db ...
Creating db ... done
Creating javaee_web_1 ...
Creating javaee_web_1 ... done
```
The output may differ slightly if the images are downloaded as well.
Started services can be verified using the command `docker-compose ps`:
```
Name Command State Ports
------------------------------------------------------------------------------------------------------
db docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
javaee_web_1 /bin/sh -c java -jar /opt/ ... Up 0.0.0.0:8080->8080/tcp, 0.0.0.0:9990->9990/tcp
```
This provides a consolidated view of all the services, and containers within each of them.
Alternatively, the containers in this application, and any additional containers running on this Docker host can be verified by using the usual `docker container ls` command:
```
Name Command State Ports
------------------------------------------------------------------------------------------------------
db docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
javaee_web_1 /bin/sh -c java -jar /opt/ ... Up 0.0.0.0:8080->8080/tcp, 0.0.0.0:9990->9990/tcp
javaee $ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e862a5eb9484 arungupta/docker-javaee:dockerconeu17 "/bin/sh -c 'java ..." 38 seconds ago Up 36 seconds 0.0.0.0:8080->8080/tcp, 0.0.0.0:9990->9990/tcp javaee_web_1
08792c20c066 mysql:8 "docker-entrypoint..." 39 seconds ago Up 37 seconds 0.0.0.0:3306->3306/tcp db
```
Service logs can be seen using `docker-compose logs` command, and looks like:
[source, text]
----
Attaching to dockerjavaee_web_1, db
web_1 | 23:54:21,584 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
web_1 | 23:54:21,688 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: WildFly Core 2.0.10.Final "Kenny" starting
web_1 | 2017-10-06 23:54:22,687 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 20) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
. . .
web_1 | 2017-10-06 23:54:23,259 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
web_1 | 2017-10-06 23:54:24,962 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Core 2.0.10.Final "Kenny" started in 3406ms - Started 112 of 124 services (21 services are lazy, passive or on-demand)
web_1 | 2017-10-06 23:54:25,020 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080
web_1 | 2017-10-06 23:54:26,146 INFO [org.wildfly.swarm.runtime.deployer] (main) deploying docker-javaee.war
web_1 | 2017-10-06 23:54:26,169 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "docker-javaee.war" (runtime-name: "docker-javaee.war")
web_1 | 2017-10-06 23:54:27,748 INFO [org.jboss.as.jpa] (MSC service thread 1-2) WFLYJPA0002: Read persistence.xml for MyPU
web_1 | 2017-10-06 23:54:27,887 WARN [org.jboss.as.dependency.private] (MSC service thread 1-7) WFLYSRV0018: Deployment "deployment.docker-javaee.war" is using a private module ("org.jboss.jts:main") which may be changed or removed in future versions without notice.
. . .
web_1 | 2017-10-06 23:54:29,128 INFO [stdout] (ServerService Thread Pool -- 4) Hibernate: create table EMPLOYEE_SCHEMA (id integer not null, name varchar(40), primary key (id))
web_1 | 2017-10-06 23:54:29,132 INFO [stdout] (ServerService Thread Pool -- 4) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (1, 'Penny')
web_1 | 2017-10-06 23:54:29,133 INFO [stdout] (ServerService Thread Pool -- 4) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (2, 'Sheldon')
web_1 | 2017-10-06 23:54:29,133 INFO [stdout] (ServerService Thread Pool -- 4) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (3, 'Amy')
web_1 | 2017-10-06 23:54:29,133 INFO [stdout] (ServerService Thread Pool -- 4) Hibernate: INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (4, 'Leonard')
. . .
web_1 | 2017-10-06 23:54:30,050 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 4) WFLYUT0021: Registered web context: /
web_1 | 2017-10-06 23:54:30,518 INFO [org.jboss.as.server] (main) WFLYSRV0010: Deployed "docker-javaee.war" (runtime-name : "docker-javaee.war")
web_1 | 2017-10-06 23:56:01,766 INFO [stdout] (default task-1) Hibernate: select employee0_.id as id1_0_, employee0_.name as name2_0_ from EMPLOYEE_SCHEMA employee0_
db | Initializing database
. . .
db |
db |
db | MySQL init process done. Ready for start up.
db |
. . .
db | 2017-10-06T23:54:29.434423Z 0 [Note] /usr/sbin/mysqld: ready for connections. Version: '8.0.3-rc-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
db | 2017-10-06T23:54:30.281973Z 0 [Note] InnoDB: Buffer pool(s) load completed at 171006 23:54:30
----
`depends_on` attribute in the Compose definition file ensures the container start up order. But application-level start up needs to be ensured by the applications running inside container. In our case, this can be achieved by WildFly Swarm using `swarm.datasources.data-sources.KEY.stale-connection-checker-class-name` as defined at https://reference.wildfly-swarm.io/fractions/datasources.html.
== Verify application
Now that the WildFly Swarm and MySQL have been configured, let's access the application. You need to specify IP address of the host where WildFly is running (`localhost` in our case).
The endpoint can be accessed in this case as:
curl -v http://localhost:8080/resources/employees
The output is shown as:
```
curl -v http://localhost:8080/resources/employees
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /resources/employees HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: application/xml
< Content-Length: 478
< Date: Sat, 07 Oct 2017 00:05:41 GMT
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact
1Penny2Sheldon3Amy4Leonard5Bernadette6Raj7Howard8Priya
```
This shows the result from querying the database.
A single resource can be obtained:
curl -v http://localhost:8080/resources/employees/1
It shows the output:
```
curl -v http://localhost:8080/resources/employees/1
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /resources/employees/1 HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: application/xml
< Content-Length: 104
< Date: Sat, 07 Oct 2017 00:06:33 GMT
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact
1Penny
```
== Shutdown application
Shutdown the application using `docker-compose down`:
```
Stopping javaee_web_1 ... done
Stopping db ... done
Removing javaee_web_1 ... done
Removing db ... done
Removing network javaee_default
```
This stops the container in each service and removes all the services. It also deletes any networks that were created as part of this application.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch06-swarm.adoc
================================================
:toc:
:imagesdir: images
[[Swarm_Mode]]
= Deploy application using Swarm mode
Docker Engine includes swarm mode for natively managing a cluster of Docker Engines. The Docker CLI can be used to create a swarm, deploy application services to a swarm, and manage swarm behavior. Complete details are available at: https://docs.docker.com/engine/swarm/. It's important to understand the https://docs.docker.com/engine/swarm/key-concepts/[Swarm mode key concepts] before starting with this chapter.
Swarm is typically a cluster of multiple Docker Engines. But for simplicity we'll run a single node Swarm.
This section will deploy an application that will provide a CRUD/REST interface on a data bucket in https://www.mysql.com/[MySQL]. This is achieved by using a Java EE application deployed on http://wildfly.org[WildFly] to access the database.
== Initialize Swarm
Initialize Swarm mode using the following command:
docker swarm init
This starts a Swarm Manager. By default, a manager node is also a worker but can be configured to be a manager-only.
Find some information about this one-node cluster using the command `docker info`
```
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 17
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: p9a1tqcjh58ro9ucgtqxa2wgq
Is Manager: true
ClusterID: r3xdxly8zv82e4kg38krd0vog
Managers: 1
Nodes: 1
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.65.2
Manager Addresses:
192.168.65.2:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: moby
ID: TJSZ:O44Y:PWGZ:ZWZM:SA73:2UHI:VVKV:KLAH:5NPO:AXQZ:XWZD:6IRJ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 35
Goroutines: 142
System Time: 2017-10-05T20:57:14.037442426Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
```
This cluster has 1 node, and that is a manager. By default, the manager node is also a worker node. This means the containers can run on this node.
== Multi-container application
This section describes how to deploy a multi-container application using Docker Compose to Swarm mode use Docker CLI.
Create a new directory and `cd` to it:
mkdir webapp
cd webapp
Create a new Compose definition `docker-compose.yml` using this link:ch05-compose.adoc#configuration-file[ configuration file].
This application can be started as:
docker stack deploy --compose-file=docker-compose.yml webapp
This shows the output as:
```
Ignoring deprecated options:
container_name: Setting the container name is not supported.
Creating network webapp_default
Creating service webapp_db
Creating service webapp_web
```
WildFly Swarm and MySQL services are started on this node. Each service has a single container. If the Swarm mode is enabled on multiple nodes then the containers will be distributed across them.
A new overlay network is created. This can be verified using the command `docker network ls`. This network allows multiple containers on different hosts to communicate with each other.
== Verify service and containers in application
Verify that the WildFly and MySQL services are running using `docker service ls`:
```
ID NAME MODE REPLICAS IMAGE PORTS
j21lwelj529f webapp_db replicated 1/1 mysql:8 *:3306->3306/tcp
m0m44axt35cg webapp_web replicated 1/1 arungupta/docker-javaee:dockerconeu17 *:8080->8080/tcp,*:9990->9990/tcp
```
More details about the service can be obtained using `docker service inspect webapp_web`:
[source, yml]
----
[
{
"ID": "m0m44axt35cgjetcjwzls7u9r",
"Version": {
"Index": 22
},
"CreatedAt": "2017-10-07T00:17:44.038961419Z",
"UpdatedAt": "2017-10-07T00:17:44.040746062Z",
"Spec": {
"Name": "webapp_web",
"Labels": {
"com.docker.stack.image": "arungupta/docker-javaee:dockerconeu17",
"com.docker.stack.namespace": "webapp"
},
"TaskTemplate": {
"ContainerSpec": {
"Image": "arungupta/docker-javaee:dockerconeu17@sha256:6a403c35d2ab4442f029849207068eadd8180c67e2166478bc3294adbf578251",
"Labels": {
"com.docker.stack.namespace": "webapp"
},
"Privileges": {
"CredentialSpec": null,
"SELinuxContext": null
},
"StopGracePeriod": 10000000000,
"DNSConfig": {}
},
"Resources": {},
"RestartPolicy": {
"Condition": "any",
"Delay": 5000000000,
"MaxAttempts": 0
},
"Placement": {
"Platforms": [
{
"Architecture": "amd64",
"OS": "linux"
}
]
},
"Networks": [
{
"Target": "bwnp1nvkkga68dirhp1ue7qey",
"Aliases": [
"web"
]
}
],
"ForceUpdate": 0,
"Runtime": "container"
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 1,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"RollbackConfig": {
"Parallelism": 1,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"EndpointSpec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 8080,
"PublishedPort": 8080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 9990,
"PublishedPort": 9990,
"PublishMode": "ingress"
}
]
}
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 8080,
"PublishedPort": 8080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 9990,
"PublishedPort": 9990,
"PublishMode": "ingress"
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 8080,
"PublishedPort": 8080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 9990,
"PublishedPort": 9990,
"PublishMode": "ingress"
}
],
"VirtualIPs": [
{
"NetworkID": "vysfza7wgjepdlutuwuigbws1",
"Addr": "10.255.0.5/16"
},
{
"NetworkID": "bwnp1nvkkga68dirhp1ue7qey",
"Addr": "10.0.0.4/24"
}
]
}
}
]
----
Logs for the service can be seen using `docker service logs -f webapp_web`:
```
webapp_web.1.lf3y5k7pkpt9@moby | 00:17:47,296 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
webapp_web.1.lf3y5k7pkpt9@moby | 00:17:47,404 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: WildFly Core 2.0.10.Final "Kenny" starting
webapp_web.1.lf3y5k7pkpt9@moby | 2017-10-07 00:17:48,636 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 20) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
. . .
webapp_web.1.lf3y5k7pkpt9@moby | 2017-10-07 00:17:56,619 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 12) RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.javaee.samples.employees.MyApplication
webapp_web.1.lf3y5k7pkpt9@moby | 2017-10-07 00:17:56,621 WARN [org.jboss.as.weld] (ServerService Thread Pool -- 12) WFLYWELD0052: Using deployment classloader to load proxy classes for module com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider:main. Package-private access will not work. To fix this the module should declare dependencies on [org.jboss.weld.core, org.jboss.weld.spi]
webapp_web.1.lf3y5k7pkpt9@moby | 2017-10-07 00:17:56,682 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 12) WFLYUT0021: Registered web context: /
webapp_web.1.lf3y5k7pkpt9@moby | 2017-10-07 00:17:57,094 INFO [org.jboss.as.server] (main) WFLYSRV0010: Deployed "docker-javaee.war" (runtime-name : "docker-javaee.war")
```
Make sure to wait for the last log statement to show.
== Access application
Now that the WildFly and MySQL servers have been configured, let's access the application. You need to specify IP address of the host where WildFly is running (`localhost` in our case).
The endpoint can be accessed in this case as:
curl -v http://localhost:8080/resources/employees
The output is shown as:
```
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /resources/employees HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: application/xml
< Content-Length: 478
< Date: Sat, 07 Oct 2017 00:22:59 GMT
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact
1Penny2Sheldon3Amy4Leonard5Bernadette6Raj7Howard8Priya
```
This shows all employees stored in the database.
== Stop application
If you only want to stop the application temporarily while keeping any networks that were created as part of this application, the recommended way is to set the amount of service replicas to 0.
docker service scale webapp_db=0 webapp_web=0
It shows the output:
```
webapp_db scaled to 0
webapp_web scaled to 0
Since --detach=false was not specified, tasks will be scaled in the background.
In a future release, --detach=false will become the default.
```
This is especially useful if the stack contains volumes and you want to keep the data. It allows you to simply start the stack again with setting the replicas to a number higher than 0.
== Remove application completely
Shutdown the application using `docker stack rm webapp`:
```
Removing service webapp_db
Removing service webapp_web
Removing network webapp_default
```
This stops the container in each service and removes the services. It also deletes any networks that were created as part of this application.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch07-eclipse.adoc
================================================
:toc:
:imagesdir: images
[[Docker_Eclipse]]
== Docker and Eclipse
This chapter will show you basic Docker tooling with Eclipse:
- Pull/Push/Build Docker images
- Run/Start/Stop/Kill Docker containers
- Customize views
Watch a quick video explaining the key steps in https://www.youtube.com/watch?v=XmhEZiS26os.
=== Install Docker Tooling in Eclipse
Download http://www.eclipse.org/downloads/eclipse-packages/[Eclipse IDE for Java EE Developers] and install.
Go to "`Help`" menu, "`Install New Software...`".
Select Eclipse update site for the release, search for Docker, select "`Docker Tooling`".
image::docker-eclipse-update-site-selection.png[]
Click on "`Next>`", "`Next>`", accept the license agreement, click on "`Finish`" to start the installation.
Restart Eclipse for the installation to complete.
=== Docker Perspective and View
Go to "`Window`", "`Perspective`", "`Open Perspective`", "`Other...`", "`Docker Tooling`".
image::docker-eclipse-docker-perspective.png[]
Click on "`OK`" to see the perspective.
image::docker-eclipse-docker-perspective-default-look.png[]
This has three views:
- *Docker Explorer*: a tree view listing all connected Docker instances, with image and containers.
- *Docker Images*: a table view listing containers for selected Docker connection.
- *Docker Containers*: a table view listing containers for selected Docker connection
Click on the text in Docker Explorer to create a new connection. If you are on Mac/Windows, you are likely using Docker for Mac/Windows or Docker Toolbox to setup Docker Host. Eclipse allows to configure Docker Engine using both Docker for Mac/Windows and Docker Toolbox.
If you are using Docker for Mac/Windows, then the default values are shown:
image::docker-eclipse-docker-connection.png[]
Click on "`Test Connection`" to test the connection.
image::docker-eclipse-docker-connection-test.png[]
If you are using Toolbox, enter the values as shown:
image::docker-eclipse-docker-connection-toolbox.png[]
The exact value of TCP Connection can be found using `docker-machine ls` command. The path for authentication is the directory name where certificates for your Docker Machine, `couchbase` in this case, are stored.
Click on "`Test Connection`" to make sure the connection is successfully configured.
image::docker-eclipse-docker-connection-test-toolbox.png[]
In either case, the configuration can be completed once the connection is tested. Click on "`Finish`" to complete the configuration.
Docker Explorer is updated to show the connection.
Containers and Images configured for the Docker Machine are shown in tabs. They can be expanded to see the list in Explorer itself.
=== Pull an Image
Expand the connection to see "`Containers`" and "`Images`".
Right-click on "`Images`" and select "`Pull...`".
Type the image name and click on "`Finish`".
image::docker-eclipse-pull-image.png[]
This image is now shown in Explorer and Docker Images tab.
image::docker-eclipse-pulled-image.png[]
Any existing images on the Docker Host will be shown here.
=== Run a Container
Select an image, right-click on it, and click on "`Run...`". It shows the options that can be configured for running the container. Some of them are:
- Publish ports on Docker host interface (`-P` or `-p` in `docker run` command)
- Keep STDIN open and allocate pseudo-TTY (`-it` on CLI)
- Remove container after it exits (`--rm` on CLI)
- Volume mapping (`-v` on CLI)
- Environment variables (`-e` on CLI)
Uncheck "`Publish all exposed ports`" box to map to corresponding ports.
image::docker-eclipse-run-container-config.png[]
Click on "`Finish`" to run the container.
Right-click on the started container, select "`Display Log`" to show the log.
image::docker-eclipse-container-display-log.png[]
The container can be paused, stopped and killed from here as well.
To see more details about the container, right-click on the container, select "`Show In`", "`Properties`".
image::docker-eclipse-container-properties.png[]
=== Build an Image
In Docker Images tab, click on the hammer icon on top right.
Give the image name, specify an empty directory, click on "`Edit Dockerfile`" to edit the contents of Dockerfile
image::docker-eclipse-build-image.png[]
Click on "`Save`" and "`Finish`" to create the image.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch07-intellij.adoc
================================================
:toc:
:imagesdir: images
[[Docker_IntelliJ]]
== Docker and IntelliJ IDEA
This chapter will show you basic Docker tooling with IntelliJ IDEA:
- Pull Docker images
- Run, stop, delete a Container
- Build an Image
=== Install Docker Plugin in IDEA
Go to "`Preferences`", "`Plugins`", "`Install JetBrains plugin...`", search on "`docker`" and click on "`Install`"
image::docker-intellij-plugin-install.png[]
Restart IntelliJ IDEA to active plugin.
Click on "`Create New Project`", select "`Java`", "`Web Application`"
image::docker-intellij-create-java-project.png[]
Click on "`Next`", give the project a name "`dockercon`", click on "`Finish`". This will open up the project in IntelliJ window.
Go to "`Preferences`", "`Clouds`", add a new deployment by clicking on "`+`". Click on "`Import credentials from Docker Machine`", "`Detect`", and see a successful connection. You may have to check the IP address of your Docker Machine. Find the IP address of your Docker Machine as `docker-machine ip ` and specify the correct IP address here.
image::docker-intellij-cloud-connection.png[]
Go to "`View`", "`Tool Windows`", "`Docker Tooling Window`". Click on "`Connect`"" to connect with Docker Machine. Make sure Docker Machine is running.
WARNING: IDEA does not work with "`Docker for Mac`" at this time. (ADD BUG #)
image::docker-intellij-tool-window.png[]
=== Pull an Image
Select top-level node with the name "`Docker`", click on "`Pull image`"
image::docker-intellij-pull-image.png[]
Type an image name, such as `arungupta/couchbase`, and "`OK`"
image::docker-intellij-repository-name.png[]
Expand "`Containers`" and "`Images`" to see existing running containers and images.
The specified image is now downloaded and shown as well.
=== Run a Container
Select the downloaded image, click on "`Create container`"
Select "`After launch`" and enter the URL as `http://192.168.99.100:8091`. Make sure to match the IP address of your Docker Machine.
image::docker-intellij-deployment-after-launch.png[]
In "`Container`" tab, add "`Port bindings`" for `8091:8091`
image::docker-intellij-container-ports.png[]
Click on "`Run`" to run the container.
This will bring up the browser window and display the page http://192.168.99.100:8091 and looks like:
image::docker-intellij-run-container-browser.png[]
This image uses http://developer.couchbase.com/documentation/server/current/rest-api/rest-endpoints-all.html[Couchbase REST API] to configure the Couchbase server.
Right-click on the running container, select "`Inspect`" to see more details about the container.
image::docker-intellij-container-inspect.png[]
Click on "`Stop container`" to stop the container and "`Delete container`" to delete the container.
=== Build an Image
. Refer to the instructions https://www.jetbrains.com/help/idea/2016.1/docker.html
. Right-click on the project, create a new directory `docker-dir`
. Artifact
.. Click on top-right for "`Project Structure`"
.. select "`Artifacts`"
.. change "`Type:`" to "`Web Application: Archive`"
.. change the name to `dockercon`
.. change `Output directory` to `docker-dir`
. Create "`Dockerfile`" in this directory. Use the contents
+
```
FROM jboss/wildfly
ADD dockercon.war /opt/jboss/wildfly/standalone/deployments/
```
+
. "`Run`", "`Edit Configurations`", add new "`Docker Deployment`"
.. "`Deployment`" tab
... Change the name to `dockercon`
... Select "`After launch`", change the URL to "`http://192.168.99.100:18080/dockercon/index.jsp`"
... In "`Before launch`", add "`Build Artifacts`" and select the artifact
.. "`Container`" tab
... Add "`Port bindings`" for "`8080:18080`"
. View, Tool Windows, Docker, connect to it
. Run the project
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch07-netbeans.adoc
================================================
:toc:
:imagesdir: images
[[Docker_NetBeans]]
== Docker and NetBeans
This chapter will show you basic Docker tooling with NetBeans:
- Pull/Build Docker images
- Run/Start/Stop Docker containers
NOTE: NetBeans only supports configuring Docker Engine running using Docker Toolbox. This means that if you are running Docker for Mac or Docker for Windows then NetBeans cannot be used.
=== Configure Docker Host
In "`Services`" window, right-click on "`Docker`", click on "`Add Docker...`"
image::docker-netbeans-add-docker.png[]
Specify Docker Machine coordinates, click on "`Test Connection`" to validate the connection:
image::docker-netbeans-add-docker-instance.png[]
NOTE: No support for Docker for Mac/Windows, filed as https://netbeans.org/bugzilla/show_bug.cgi?id=262398[#262398].
Click on "`Finish`" to see:
image::docker-netbeans-added-docker-instance.png[]
Expand the connection to see "`Images`" and "`Containers`".
=== Pull an Image
Right-click on Docker node and select "`Pull...`".
image::docker-netbeans-pull-image.png[]
Type the image name to narrow down the search from Docker Store:
image::docker-netbeans-search-image.png[]
Click on "`Pull`" to pull the image.
Log is updated in the Output window:
image::docker-netbeans-pull-image-output.png[]
This image is now shown in Services tab
image::docker-netbeans-pulled-image.png[]
Any existing images on the Docker Host will be shown here as well.
=== Run a Container
Select an image, right-click on it, and click on "`Run...`".
image::docker-netbeans-run-container.png[]
This brings up a dialog that allows the options that can be configured for running the container. Some of them are:
- Container name
- Override the command
- Keep STDIN open and allocate pseudo-TTY (`-it` on CLI)
- Publish ports on Docker host interface (`-P` or `-p` in `docker run` command)
image::docker-netbeans-run-container-option1.png[]
Click on "`Next>`" to see the options to configure exposed ports. Click on "`Add`" to explicitly map host port "`8091`" to container port "`8091`".
image::docker-netbeans-run-container-option2.png[]
Click on "`Finish`" to run the container. "`Services`" window is updated as:
image::docker-netbeans-run-container-services.png[]
Log is shown in the "`Output`" window:
image::docker-netbeans-run-container-log.png[]
Right-click on the container, select "`Show Log`" to show the log generated by the container. The container can be paused and stopped from here as well.
=== Build an Image
On the configured Docker Host, right-click and select "`Build...`" to build a new image:
image::docker-netbeans-build-image.png[]
Specify a directory where `Dockerfile` exists, give the image name:
image::docker-netbeans-build-image-option1.png[]
Click on "`Next>`", choose the options that matter:
image::docker-netbeans-build-image-option2.png[]
Click on "`Finish`" to build the image. The image is shown in the "`Services`" window:
image::docker-netbeans-build-image-services.png[]
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch08-aws.adoc
================================================
:toc:
:imagesdir: images
= Docker for AWS
https://docs.docker.com/docker-for-aws/[Docker for AWS] is a CloudFormation template that configures Docker in swarm-mode, running on EC2 instances backed by custom AMIs. This allows to create a cluster of Docker Engine in swarm-mode with a single click. This workshop will take the https://github.com/docker/labs/blob/master/developer-tools/java/chapters/ch06-swarm.adoc#multi-container-application[multi-container application] and deploy it on multiple hosts.
== Requirements
What is required for creating this CloudFormation template?
. https://docs.docker.com/docker-for-aws/iam-permissions/[Permissions]
. SSH key in AWS in the region where you want to deploy (required to access the completed Docker install). http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html[Amazon EC2 Key Pair] explains how to add SSH key to your account
. AWS account that support EC2-VPC
== Create cluster
https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=Docker&templateURL=https://editions-us-east-1.s3.amazonaws.com/aws/stable/Docker.tmpl[Launch Stack] to create the CloudFormation template.
.Select template
image::docker-aws-1.png[]
Click on `Next`
.Swarm size
image::docker-aws-2.png[]
Select the number of Swarm manager (3) and worker (5) nodes. This wll create a 8 node cluster. Each node will initialize a new EC2 instance. Feel free to alter the number of master and worker nodes. For example, a more reasonable number for testing may be 1 master and 3 worker nodes.
Select the SSH key that will be used to access the cluster.
By default, the template is configured to redirect all log statements to CloudWatch. Until https://github.com/moby/moby/issues/30691[#30691] is fixed, the logs will only be available using CloudWatch. Alternatively, you may select to not redirect logs to CloudWatch. In this case, the usual command to get the logs will work.
Scroll down to select manager and worker properties.
.Swarm manager/worker properties
image::docker-aws-3.png[]
`m4.large` (2 vCPU and 8 GB memory) is a good start for manager. `m4.xlarge` (4 vCPU and 16 GB memory) is a good start for worker node. Feel free to choose `m3.medium` (1 vCPU and 3.75 GB memory) for manager and `m3.large` (2 vCPU and 7.5 GB memory) for a smaller cluster. Make sure the EC2 instance size is chosen to accommodate the processing and memory needs of containers that will run there.
Click on `Next`
.Swarm options
image::docker-aws-4.png[]
Take default for all the options and click on `Next`.
.Swarm review
image::docker-aws-5.png[]
.Swarm IAM accept
image::docker-aws-6.png[]
Accept the checkbox for CloudFormation to create IAM resources. Click on `Create` to create the Swarm cluster.
It will take a few minutes for the CloudFormation template to complete. The output will look like:
.Swarm CloudFormation complete
image::docker-aws-7.png[]
https://console.aws.amazon.com/ec2/v2/home?#Instances:search=docker;sort=instanceState[EC2 Console] will show the EC2 instances for manager and worker.
.EC2 console
image::docker-aws-8.png[]
Select one of the manager nodes, copy the public IP address:
[[Swarm_manager]]
.Swarm manager
image::docker-aws-9.png[]
Create a SSH tunnel using the command:
ssh -i ~/.ssh/arun-us-east1.pem -o StrictHostKeyChecking=no -NL localhost:2374:/var/run/docker.sock docker@ec2-34-200-216-30.compute-1.amazonaws.com &
Get more details about the cluster using the command `docker -H localhost:2374 info`. This shows the output:
```
Containers: 5
Running: 4
Paused: 0
Stopped: 1
Images: 5
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: awslogs
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: rb6rju2eln0bn80z7lqocjkuy
Is Manager: true
ClusterID: t38bbbex5w3bpfmnogalxn5k1
Managers: 3
Nodes: 8
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 172.31.46.94
Manager Addresses:
172.31.26.163:2377
172.31.46.94:2377
172.31.8.136:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.785GiB
Name: ip-172-31-46-94.ec2.internal
ID: F65G:UTHH:7YEM:XPEZ:NBIZ:XN25:ONG6:QN5R:7MGJ:I3RS:BAX3:UO7A
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 299
Goroutines: 399
System Time: 2017-10-07T01:04:00.971903882Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Labels:
os=linux
region=us-east-1
availability_zone=us-east-1c
instance_type=m4.large
node_type=manager
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
```
List of nodes in the cluster can be seen using `docker -H localhost:2374 node ls`:
```
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
xdhwdiglfs5wsvkcl0j65wl04 ip-172-31-4-89.ec2.internal Ready Active
xbrejk2g7mk9v15hg9xzu3syq ip-172-31-8-136.ec2.internal Ready Active Leader
bhwc67r78cfqtquri82qdwtnk ip-172-31-13-38.ec2.internal Ready Active
ygxdfloly3x203x9p5wbpk34d ip-172-31-17-74.ec2.internal Ready Active
toyfec889wuqdix6z618mlj85 ip-172-31-26-163.ec2.internal Ready Active Reachable
37lzvgrtlnnq0lnr3cip0fwhw ip-172-31-28-204.ec2.internal Ready Active
k2aprr08b3q28nvze9uv26821 ip-172-31-39-252.ec2.internal Ready Active
rb6rju2eln0bn80z7lqocjkuy * ip-172-31-46-94.ec2.internal Ready Active Reachable
```
== Multi-container application to multi-host
Use the link:ch05-compose.adoc#configuration-file[Compose file] to deploy a multi-container application to this Docker cluster. This will deploy a multi-container application to multiple hosts.
Create a new directory and `cd` to it:
mkdir webapp
cd webapp
Create a new Compose definition `docker-compose.yml` using the configuration file from https://github.com/docker/labs/blob/master/developer-tools/java/chapters/ch05-compose.adoc#configuration-file.
The command is:
```
docker -H localhost:2374 stack deploy --compose-file=docker-compose.yml webapp
```
The output is:
```
Ignoring deprecated options:
container_name: Setting the container name is not supported.
Creating network webapp_default
Creating service webapp_web
Creating service webapp_db
```
WildFly Swarm and MySQL services are started on this cluster. Each service has a single container. A new overlay network is created. This allows multiple containers on different hosts to communicate with each other.
== Verify service and containers in application
Verify that the WildFly and Couchbase services are running using `docker -H localhost:2374 service ls`:
```
ID NAME MODE REPLICAS IMAGE PORTS
q4d578ime45e webapp_db replicated 1/1 mysql:8 *:3306->3306/tcp
qt5qrzp1jpyq webapp_web replicated 1/1 arungupta/docker-javaee:dockerconeu17 *:8080->8080/tcp,*:9990->9990/tcp
```
`REPLICAS` colum shows that one of one replica for the container is running for each service. It might take a few minutes for the service to be running as the image needs to be downloaded on the host where the container is started.
Let's find out which node the services are running. Do this for the web application first:
```
docker -H localhost:2374 service ps webapp_web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
npmunk4ll9f4 webapp_web.1 arungupta/docker-javaee:dockerconeu17 ip-172-31-39-252.ec2.internal Running Running 2 hours ago
```
The `NODE` column shows the internal IP address of the node where this service is running.
Now, do this for the database:
```
docker -H localhost:2374 service ps webapp_db
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
vzaji4xdi2qh webapp_db.1 mysql:8 ip-172-31-17-74.ec2.internal Running Running 2 hours ago
```
The `NODE` column for this service shows that the service is running on a different node.
More details about the service can be obtained using `docker -H localhost:2374 service inspect webapp_web`:
```
[
{
"ID": "qt5qrzp1jpyq1ur7qhg55ijf1",
"Version": {
"Index": 58
},
"CreatedAt": "2017-10-07T01:09:32.519975146Z",
"UpdatedAt": "2017-10-07T01:09:32.535587602Z",
"Spec": {
"Name": "webapp_web",
"Labels": {
"com.docker.stack.image": "arungupta/docker-javaee:dockerconeu17",
"com.docker.stack.namespace": "webapp"
},
"TaskTemplate": {
"ContainerSpec": {
"Image": "arungupta/docker-javaee:dockerconeu17@sha256:6a403c35d2ab4442f029849207068eadd8180c67e2166478bc3294adbf578251",
"Labels": {
"com.docker.stack.namespace": "webapp"
},
"Privileges": {
"CredentialSpec": null,
"SELinuxContext": null
},
"StopGracePeriod": 10000000000,
"DNSConfig": {}
},
"Resources": {},
"RestartPolicy": {
"Condition": "any",
"Delay": 5000000000,
"MaxAttempts": 0
},
"Placement": {
"Platforms": [
{
"Architecture": "amd64",
"OS": "linux"
}
]
},
"Networks": [
{
"Target": "b0ig9m1qsjax95tp9m1i2m4yo",
"Aliases": [
"web"
]
}
],
"ForceUpdate": 0,
"Runtime": "container"
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 1,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"RollbackConfig": {
"Parallelism": 1,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"EndpointSpec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 8080,
"PublishedPort": 8080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 9990,
"PublishedPort": 9990,
"PublishMode": "ingress"
}
]
}
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 8080,
"PublishedPort": 8080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 9990,
"PublishedPort": 9990,
"PublishMode": "ingress"
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 8080,
"PublishedPort": 8080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 9990,
"PublishedPort": 9990,
"PublishMode": "ingress"
}
],
"VirtualIPs": [
{
"NetworkID": "i41xh4kmuwl5vc47h536l3mxs",
"Addr": "10.255.0.10/16"
},
{
"NetworkID": "b0ig9m1qsjax95tp9m1i2m4yo",
"Addr": "10.0.0.2/24"
}
]
}
}
]
```
Logs for the service are redirected to CloudWatch and thus cannot be seen using `docker service logs`. This will be fixed with https://github.com/moby/moby/issues/30691[#30691]. Let's view the logs using using https://console.aws.amazon.com/cloudwatch/home?#logs:prefix=Docker[CloudWatch Logs].
.CloudWatch log group
image::docker-aws-10.png[]
Select the log group:
.CloudWatch log stream
image::docker-aws-11.png[]
Pick `webapp_web.xxx` log stream to see the log statements from WildFly Swarm:
.CloudWatch application log stream
image::docker-aws-12.png[]
== Access application
Application is accessed using manager's IP address and on port 8080. By default, the port 8080 is not open.
In https://console.aws.amazon.com/ec2/v2/home?#Instances:search=docker;sort=instanceState[EC2 Console], select an EC2 instance with name `Docker-Manager`, click on `Docker-Managerxxx` in `Security groups`. Click on `Inbound`, `Edit`, `Add Rule`, and create a rule to enable TCP traffic on port 8080.
.Open port 8080 in Docker manager
image::docker-aws-13.png[]
Click on `Save` to save the rules.
Now, the application is accessible using the command `curl -v http://ec2-34-200-216-30.compute-1.amazonaws.com:8080/resources/employees` and shows output:
```
* Trying 34.200.216.30...
* TCP_NODELAY set
* Connected to ec2-34-200-216-30.compute-1.amazonaws.com (34.200.216.30) port 8080 (#0)
> GET /resources/employees HTTP/1.1
> Host: ec2-34-200-216-30.compute-1.amazonaws.com:8080
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: application/xml
< Content-Length: 478
< Date: Sat, 07 Oct 2017 02:53:11 GMT
<
* Curl_http_done: called premature == 0
* Connection #0 to host ec2-34-200-216-30.compute-1.amazonaws.com left intact
1Penny2Sheldon3Amy4Leonard5Bernadette6Raj7Howard8Priya
```
== Shutdown application
Shutdown the application using the command `docker -H localhost:2374 stack rm webapp`:
```
Removing service webapp_db
Removing service webapp_web
Removing network webapp_default
```
This stops the container in each service and removes the services. It also deletes any networks that were created as part of this application.
== Shutdown cluster
Docker cluster can be shutdown by deleting the stack created by CloudFormation:
.Delete CloudFormation template
image::docker-aws-14.png[]
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch08-azure.adoc
================================================
:toc:
:imagesdir: images
= Docker for Azure
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch08-cloud.adoc
================================================
:toc:
:imagesdir: images
= Docker Cloud
== Key Concepts
Docker Cloud is a SaaS that allows you to build, deploy and manage Docker containers in physical servers, virtual machine or cloud providers.
The main concepts of Docker Cloud are:
- *Nodes* are individual Linux hosts/VMs used to deploy and run your applications. New nodes can be provisioned to increase the capacity. Docker Cloud does not provide hosting services. Nodes are provisioned using physical servers, virtual machine or cloud providers.
- *Node Clusters* are logical groups of nodes of the same type. Node Clusters allow to scale the infrastructure easily by provisioning more nodes.
- *Services* are logical groups of containers from the same image. Services make it simple to scale your application across different nodes.
This chapter will show how to use TomEE Docker image and deploy it using Docker Cloud CLI.
=== Docker Cloud CLI
Install Docker Cloud CLI following the https://docs.docker.com/docker-cloud/installing-cli/[instructions].
== Create new Docker Cloud Node
Create a new node cluster:
[source, text]
----
docker-cloud nodecluster create -t 1 --tag wildfly wildfly-node aws us-west-1 m3.large
----
This node cluster has a single node (`-t 1`) and uses the tag "`wildfly`" (`--tag wildfly`). Last four parameters are nodecluster name (`couchbase-node`), provider (`aws`), region (`us-west-1`) and node type (`m3.large`).
Each node in this node cluster will be given the assigned tag. This will be used later to assign services to a specific node or node cluster.
Deploying a node can take a few minutes. Current status can also be seen https://cloud.docker.com/app/arungupta/nodecluster/list/1?page_size=10[Docker Cloud dashboard]:
image::docker-cloud-nodecluster.png[]
== Create a new Docker Cloud Service
Create a Docker Cloud Service:
[source, text]
----
docker-cloud service create --name wildfly --tag wildfly -p 8080:8080 jboss/wildfly
124aa470-4e44-4f19-b0f0-d0c2616510a7
----
https://cloud.docker.com/app/arungupta/service/list/1?name__icontains=wildfly&page=1&page_size=10[Docker Cloud dashboard] will look like:
image::docker-cloud-services.png[]
Start the Service:
[source, text]
----
docker-cloud service start 124aa470-4e44-4f19-b0f0-d0c2616510a7
----
Check the service logs:
[source, text]
----
docker-cloud service logs 124aa470-4e44-4f19-b0f0-d0c2616510a7
----
It shows the output as:
[source, text]
----
wildfly-1 | 2017-02-04T00:00:22.752881989Z =========================================================================
wildfly-1 | 2017-02-04T00:00:22.752982683Z
wildfly-1 | 2017-02-04T00:00:22.753058247Z JBoss Bootstrap Environment
wildfly-1 | 2017-02-04T00:00:22.753149954Z
wildfly-1 | 2017-02-04T00:00:22.753228180Z JBOSS_HOME: /opt/jboss/wildfly
wildfly-1 | 2017-02-04T00:00:22.753313935Z
wildfly-1 | 2017-02-04T00:00:22.753385039Z JAVA: /usr/lib/jvm/java/bin/java
wildfly-1 | 2017-02-04T00:00:22.753537123Z
wildfly-1 | 2017-02-04T00:00:22.753926931Z JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
. . .
wildfly-1 | 2017-02-04T00:00:28.062486850Z 00:00:28,062 INFO [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.1.5.Final (Apache CXF 3.1.6)
wildfly-1 | 2017-02-04T00:00:28.360806943Z 00:00:28,359 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
wildfly-1 | 2017-02-04T00:00:28.361466490Z 00:00:28,360 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
wildfly-1 | 2017-02-04T00:00:28.362342136Z 00:00:28,361 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 5505ms - Started 331 of 577 services (393 services are lazy, passive or on-demand)
----
== Access WildFly Server in Docker Cloud
Inspect the Docker Cloud service for the exposed container ports:
```
docker-cloud service inspect 124aa470-4e44-4f19-b0f0-d0c2616510a7 | jq ".container_ports"
```
This shows the output as:
```
[
{
"protocol": "tcp",
"outer_port": 8080,
"inner_port": 8080,
"port_name": "http-alt",
"published": true,
"endpoint_uri": "http://wildfly.124aa470.svc.dockerapp.io:8080/"
}
]
```
Access the main page of TomEE at http://wildfly.124aa470.svc.dockerapp.io:8080/ to see:
image::docker-cloud-wildfly.png[]
== Terminate the Docker Cloud Service and Node
Check the list of Docker Cloud services running using the command `docker-cloud service ps`:
```
NAME UUID STATUS #CONTAINERS IMAGE DEPLOYED PUBLIC DNS STACK
wildfly 124aa470 ▶ Running 1 jboss/wildfly:latest 7 minutes ago wildfly.124aa470.svc.dockerapp.io
```
Use the UUID to terminate the service:
[source, text]
----
docker-cloud service terminate 124aa470
----
Check the list of nodes using `docker-cloud node ls` command:
```
UUID FQDN LASTSEEN STATUS CLUSTER DOCKER_VER
0240951d 0240951d-27b6-4295-8ff8-ea443d668765.node.dockerapp.io 28 seconds ago ▶ Deployed wildfly-node 1.11.2-cs5
```
Terminate the node as:
```
docker-cloud node rm 0240951d
```
Check the list of nodecluster using `docker-cloud nodecluster ls` command:
```
NAME UUID REGION TYPE DEPLOYED STATUS CURRENT#NODES TARGET#NODES
wildfly-node fb2f6292 us-west-1 m3.large 23 minutes ago Empty cluster 0 0
```
Remove the nodecluster as:
```
docker-cloud nodecluster rm wildfly-node
```
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch09-cicd.adoc
================================================
:toc:
:imagesdir: images
= CI/CD using Docker
*PURPOSE*: This chapter explains how to use Jenkins and Docker to run continuous integration and continuous delivery.
There are several possible approaches to run Docker builds with Jenkins:
. Install Jenkins on your Docker host machine. Run Docker commands from your build, either using one of the several Jenkins Docker plugins, or by running Docker commands from a build step.
. Install Jenkins on your host machine and have a Jenkins slave machine with Docker installed to run your Docker builds
. Run Jenkins on Docker and use the underlying Docker installed on the host to run Docker commands.
NOTE: Another option is running Jenkins on Docker and do a complete Docker installation inside the Jenkins Docker container. This technique is called Docker in Docker and it is usually a bad idea. There are several discussions about the problems with this approach, like this one: http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ . A better approach is using Docker outside of Docker, as explained here: http://container-solutions.com/running-docker-in-jenkins-in-docker/
== Run Jenkins on Docker
In this example, we will run Jenkins on Docker and use the underlying Docker installed on the host to run Docker commands. This technique is known as Docker outside of Docker.
First, clone the project:
git clone https://github.com/fabianenardon/jenkins-docker-demo
Then, in the project folder, run:
docker-compose up
NOTE: if running on Windows, run `dos2unix plugins.txt` before running `docker-compose up`, to avoid possible errors if your file is in the Windows format.
Wait for jenkins to start and then go to the browser and open `http://localhost:8081`. Jenkins should be running.
The Jenkins installation on this lab comes pre-configured. To login use the username `jenkins` and the password `jenkins`.
== Running integration tests Jenkins
For this Continuous Integration demo, we will run a simple application that saves data on MongoDB. We will then run integration tests to check if the data was correctly saved on the database.
When running integration tests, you want to test your application in an environment as close to production as possible, so you can test interactions between the several components, services, databases, network communication, etc. Fortunately, docker can help you a lot with integration tests. There are several strategies to run integration tests, but in this application we are going to use the following:
. Start the services with a `docker-compose.yml` file created for testing purposes. This file won't have any volumes mapped, so when the test is over, no state will be saved. The test `docker-compose.yml` file won't publish any port on the host machine, so we can run simultaneous tests.
. Run the application, using the services started with the `docker-compose.yml` test file.
. Run Maven integration tests to check if the application execution produced the expected results. This will be done by checking what was saved on the MongoDB database.
. Stop the services. No state will be stored, so next time you run the integration tests, you will have a clean environment.
Create a new job on jenkins:
. Select Freestyle project
+
image::docker-ci-cd-01.png[]
+
. In Source Code Management, select Git and add the repository URL: `https://github.com/fabianenardon/mongo-docker-demo.git`
+
image::docker-ci-cd-02.png[]
+
. In Build, select Add build step and select Execute shell
+
image::docker-ci-cd-03.png[]
+
. In the shell Command, add these instructions:
+
[source, text]
----
cd sample
# Generates the images
sudo /var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/maven/bin/mvn clean install -Papp-docker-image
# Starts the mongo service. The -p option allows multiple builds to run at the same time,
# since we can start multiple instances of the containers
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml up -d mongo
# Waits for containers to start
sleep 30
# Run the application
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
run mongo-docker-demo \
java -jar /maven/jar/mongo-docker-demo-1.0-SNAPSHOT-jar-with-dependencies.jar mongo
# Run the integration tests
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml \
run mongo-docker-demo-tests \
mvn -f /maven/code/pom.xml -Dmaven.repo.local=/m2/repository \
-Pintegration-test verify
----
+
. Click on Add post-build action and select Execute a set of scripts
+
image::docker-ci-cd-04.png[]
+
. In Post-build Actions, select Execute shell
+
image::docker-ci-cd-05.png[]
+
. In the Command box, add:
+
[source, text]
----
cd sample
sudo docker-compose -p app-$BUILD_NUMBER --file src/test/resources/docker-compose.yml down
----
+
. Uncheck the `Execute script only if build succeeds` and `Execute script only if build fails` options, so this script will run always when the build ends. This way, we make sure to always stop the services.
+
[NOTE]
====
. The `-p app-$BUILD_NUMBER` option allows multiple builds to run at the same time, since we can start multiple instances of the containers. We are using Jenkins $BUILD_NUMBER variable to isolate the containers. This way, each set of services will run on its own network.
. We are running the commands with sudo because we are actually running the Docker socket on the host. Jenkins runs with the jenkins user and we added the jenkins user to the sudoers list in our image. Obviously, this can have security consequences in a production environment, since one could create a build that would access root level services on the host. You can avoid this by configuring the jenkins user on the host, so it will have access to the Docker socket and then run the commands without sudo.
====
+
. Save the build and then click on `Build now` to run it. You should see a progress bar when the build is running. You can click on the progress bar to see the build console output.
+
image::docker-ci-cd-06.png[]
+
. If the build is successful, you should see this on the build console output:
+
image::docker-ci-cd-07.png[]
== Run integration tests outside Jenkins
When creating integration tests, it is useful to be able to run and debug them outside Jenkins. In order to do that, you can simply run the same commands you ran in the Jenkins build:
[source, text]
----
cd jenkins_home/workspace/ci-test/sample
# Generates the images
mvn -f pom.xml clean install -Papp-docker-image
# Starts mongo service
docker-compose --file src/test/resources/docker-compose.yml up -d mongo
# Waits for services do start
sleep 30
# Run our application
docker-compose --file src/test/resources/docker-compose.yml \
run mongo-docker-demo \
java -jar /maven/jar/mongo-docker-demo-1.0-SNAPSHOT-jar-with-dependencies.jar mongo
# Run our integration tests
docker-compose --file src/test/resources/docker-compose.yml \
run mongo-docker-demo-tests mvn -f /maven/code/pom.xml \
-Dmaven.repo.local=/m2/repository -Pintegration-test verify
# Stop all the services
docker-compose --file src/test/resources/docker-compose.yml down
----
== Debug integration tests outside Jenkins
You can debug integration tests. This can be achieved by making your test wait for a connection at a port for debugging. You can then attach your IDE to this port and debug. The source code for this project is available at https://github.com/fabianenardon/mongo-docker-demo.git.
You need to start Mongo service and run the application again as shown in previous section.
Here is how you can debug tests in NetBeans:
. Run the integration tests in debug mode with the command shown below:
+
```
# Run integration tests in debug mode
docker run -v ~/.m2/repository:/m2/repository \
-p 5005:5005 --link mongo:mongo \
--net resources_default mongo-docker-demo-tests \
mvn -f /maven/code/pom.xml \
-Dmaven.repo.local=/m2/repository \
-Pintegration-test verify -Dmaven.failsafe.debug
```
+
This command will wait for a connection at port 5005 for debugger.
+
. Open the project in NetBeans and setup breakpoint in your test code:
+
image::docker-ci-cd-08.png[]
+
. Use `Debug` menu item to attach the debugger:
+
image::docker-ci-cd-09.png[]
+
. Attach the debugger by specifying the correct value of `host` and `port`:
+
image::docker-ci-cd-10.png[]
+
. Hit a breakpoint in tests:
+
image::docker-ci-cd-11.png[]
== Continuous delivery with Jenkins
Continuous Delivery strategies depend greatly on the application architecture. With a dockerized application like the one in our demo, the continuous delivery strategy could be to publish a new version of the application image if the tests passed. This way, next time the application runs on production, the new image will be downloaded and automatically deployed. You can publish images with Jenkins just like you invoked all the other docker commands in the build.
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch10-monitoring.adoc
================================================
:toc:
:imagesdir: images
= Monitoring Docker Containers
This chapter will cover different ways to monitor a Docker container.
== Docker CLI
`docker container stats` command displays a live stream of container(s) runtime metrics. The command supports CPU, memory usage, memory limit, and network IO metrics.
. Start a container: `docker container run --name web -d jboss/wildfly:10.1.0.Final`
. Check the container stats using `docker container stats web`. It shows the output as:
+
```
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
web 0.14% 274.9MiB / 1.952GiB 13.75% 828B / 0B 96.7MB / 4.1kB 53
```
+
The output is continually updated. It shows:
+
.. Container name
.. Percent CPU utilization
.. Total memory usage vs amount available to the container
.. Percent memory utilization
.. Network activity
.. Disk activity
.. PIDS??
+
. Check stats for multiple containers
.. Terminate single instance of the container
+
```
docker container stop web
docker container rm web
```
+
.. Create a service with multiple replicas of the container
+
```
docker swarm init
docker service create --name=web jboss/wildfly
```
+
.. Now check the stats again:
+
```
docker stats
```
+
to see the output:
+
```
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
1f9d5a1c08a8 0.24% 294.9MiB / 1.952GiB 14.75% 828B / 0B 96.5MB / 4.1kB 115
```
+
Note that the container id is shown instead of container's name in this case.
+
. Scale the service to 3 replicas:
+
```
docker service scale web=3
```
+
. The stats are now shown for all three containers:
+
```
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
1f9d5a1c08a8 0.14% 287.8MiB / 1.952GiB 14.40% 1.03kB / 0B 96.5MB / 4.1kB 53
a3395efbb6ff 0.77% 263.4MiB / 1.952GiB 13.18% 578B / 0B 0B / 4.1kB 114
f484ff2f4c12 0.06% 294.8MiB / 1.952GiB 14.75% 578B / 0B 0B / 4.1kB 114
```
+
. Display only container id and percent CPU utilization using the command `docker container stats --format "{{.Container}}: {{.CPUPerc}}"`:
+
```
55198043b6aa: 0.10%
5b5dd33b675d: 0.11%
6e98a9597e6a: 0.10%
```
+
. Format the output in a table. The results should include container name, percent CPU utilization and percent memory utilization. This can be achieved using the command:
+
```
docker container stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}"
```
+
It shows the output:
+
```
NAME CPU % MEM USAGE / LIMIT
web.2.1ic0vevvvu2nwwyc6css58ref 0.10% 267.5MiB / 1.952GiB
web.3.pwcgr58s1xo28gwa1znlrn2s3 0.11% 274.7MiB / 1.952GiB
web.1.bg1dcwagl9tzz0azuegxzoys8 0.12% 274MiB / 1.952GiB
```
+
. Display only the first result using the command `docker container stats --no-stream`:
+
```
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
55198043b6aa 0.12% 267.5MiB / 1.952GiB 13.39% 1.44kB / 0B 0B / 4.1kB 51
5b5dd33b675d 0.07% 274.7MiB / 1.952GiB 13.75% 1.51kB / 0B 0B / 4.1kB 51
6e98a9597e6a 0.26% 274.1MiB / 1.952GiB 13.71% 1.69kB / 0B 0B / 4.1kB 51
```
== Docker Remote API
Docker Remote API provides a lot more details about the health of the container. It can be invoked using the following format:
curl --unix-socket /var/run/docker.sock http://localhost/containers//stats
On Docker for Mac, enabling remote HTTP API still requires a few steps. So this command uses the `--unix-socket` option to invoke the Remote API.
A specific invocation for a container can be done as:
curl --unix-socket /var/run/docker.sock http://localhost/containers/web.1.bg1dcwagl9tzz0azuegxzoys8/stats
Note, the container name is from the previous run of the service. It will show the output:
```
{"read":"2017-10-13T14:08:38.045217731Z","preread":"0001-01-01T00:00:00Z","pids_stats":{"current":51},"blkio_stats":{"io_service_bytes_recursive":[{"major":8,"minor":0,"op":"Read","value":0},{"major":8,"minor":0,"op":"Write","value":4096},{"major":8,"minor":0,"op":"Sync","value":0},{"major":8,"minor":0,"op":"Async","value":4096},{"major":8,"minor":0,"op":"Total","value":4096}],"io_serviced_recursive":[{"major":8,"minor":0,"op":"Read","value":0},{"major":8,"minor":0,"op":"Write","value":1},{"major":8,"minor":0,"op":"Sync","value":0},{"major":8,"minor":0,"op":"Async","value":1},{"major":8,"minor":0,"op":"Total","value":1}],"io_queue_recursive":[],"io_service_time_recursive":[],"io_wait_time_recursive":[],"io_merged_recursive":[],"io_time_recursive":[],"sectors_recursive":[]},"num_procs":0,"storage_stats":{},"cpu_stats":{"cpu_usage":{"total_usage":11130296115,"percpu_usage":[2687118654,3014514615,2971860160,2456802686],"usage_in_kernelmode":2700000000,"usage_in_usermode":7630000000},"system_cpu_usage":952826800000000,"online_cpus":4,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"precpu_stats":{"cpu_usage":{"total_usage":0,"usage_in_kernelmode":0,"usage_in_usermode":0},"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"memory_stats":{"usage":288051200,"max_usage":297189376,"stats":{"active_anon":283893760,"active_file":0,"cache":135168,"dirty":16384,"hierarchical_memory_limit":9223372036854771712,"hierarchical_memsw_limit":9223372036854771712,"inactive_anon":0,"inactive_file":135168,"mapped_file":32768,"pgfault":83204,"pgmajfault":0,"pgpgin":78441,"pgpgout":9093,"rss":283914240,"rss_huge":0,"swap":0,"total_active_anon":283893760,"total_active_file":0,"total_cache":135168,"total_dirty":16384,"total_inactive_anon":0,"total_inactive_file":135168,"total_mapped_file":32768,"total_pgfault":83204,"total_pgmajfault":0,"total_pgpgin":78441,"total_pgpgout":9093,"total_rss":283914240,"total_rss_huge":0,"total_swap":0,"total_unevictable":0,"total_writeback":0,"unevictable":0,"writeback":0},"limit":2095874048},"name":"/web.1.bg1dcwagl9tzz0azuegxzoys8","id":"6e98a9597e6af085e73a4d211fff9a164aa012727a46525d4fbaa164b572e23f","networks":{"eth0":{"rx_bytes":1882,"rx_packets":37,"rx_errors":0,"rx_dropped":0,"tx_bytes":0,"tx_packets":0,"tx_errors":0,"tx_dropped":0}}}
```
As you can see, far more details about container's health are shown here. These stats are refereshed every one second. The continuous refresh of metrics can be terminated using `Ctrl + C`.
== Docker Events
`docker system events` provide real time events for the Docker host.
. In one terminal (T1), type `docker system events`. The command does not show output and waits for any event worth reporting to occur. The list of events is listed at https://docs.docker.com/engine/reference/commandline/events/#/extended-description.
. In a new terminal (T2), kill existing container using `docker service scale web=2`.
. T1 shows the updated list of events as:
+
```
2017-10-13T07:12:00.223791013-07:00 service update r4i0x8ujnn2q8osj8dowgvw72 (name=web, replicas.new=2, replicas.old=3)
2017-10-13T07:12:00.332724880-07:00 container kill 5b5dd33b675d3b6be3e6aaf0ecde928b3ac882b0a221ff71e57c86faae8181ab (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=pwcgr58s1xo28gwa1znlrn2s3, com.docker.swarm.task.name=web.3.pwcgr58s1xo28gwa1znlrn2s3, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.3.pwcgr58s1xo28gwa1znlrn2s3, signal=15, vendor=CentOS)
2017-10-13T07:12:00.613143701-07:00 container die 5b5dd33b675d3b6be3e6aaf0ecde928b3ac882b0a221ff71e57c86faae8181ab (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=pwcgr58s1xo28gwa1znlrn2s3, com.docker.swarm.task.name=web.3.pwcgr58s1xo28gwa1znlrn2s3, exitCode=0, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.3.pwcgr58s1xo28gwa1znlrn2s3, vendor=CentOS)
2017-10-13T07:12:00.897831488-07:00 network disconnect 8f8e6ce771d6db6065f2472a7e83612ff6a657de3b6d08dab0617b8a596234fa (container=5b5dd33b675d3b6be3e6aaf0ecde928b3ac882b0a221ff71e57c86faae8181ab, name=bridge, type=bridge)
2017-10-13T07:12:01.017523717-07:00 container stop 5b5dd33b675d3b6be3e6aaf0ecde928b3ac882b0a221ff71e57c86faae8181ab (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=pwcgr58s1xo28gwa1znlrn2s3, com.docker.swarm.task.name=web.3.pwcgr58s1xo28gwa1znlrn2s3, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.3.pwcgr58s1xo28gwa1znlrn2s3, vendor=CentOS)
2017-10-13T07:12:01.023414108-07:00 container destroy 5b5dd33b675d3b6be3e6aaf0ecde928b3ac882b0a221ff71e57c86faae8181ab (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=pwcgr58s1xo28gwa1znlrn2s3, com.docker.swarm.task.name=web.3.pwcgr58s1xo28gwa1znlrn2s3, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.3.pwcgr58s1xo28gwa1znlrn2s3, vendor=CentOS)
```
+
The output shows a list of events, one in each line. The events shown here are `container kill`, `container die`, `network disconnect`, `container stop`, and `container destroy`. Date and timestamp for each event is displayed at the beginning of the line. Other event specific information is displayed as well.
+
. In T2, scale the service back to 3 replicas: `docker service scale web=3`
. The output in T1 is updated to show:
+
```
2017-10-13T07:13:47.161848609-07:00 service update r4i0x8ujnn2q8osj8dowgvw72 (name=web, replicas.new=3, replicas.old=2)
2017-10-13T07:13:47.429074382-07:00 container create 0574d1fd74bef2e6fc54174e1fbeda25efd7ed270dce1d6dbede4ead19c7c485 (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=xcmylcwlag5vot4tp3l5z6oam, com.docker.swarm.task.name=web.3.xcmylcwlag5vot4tp3l5z6oam, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.3.xcmylcwlag5vot4tp3l5z6oam, vendor=CentOS)
2017-10-13T07:13:47.445010259-07:00 network connect 8f8e6ce771d6db6065f2472a7e83612ff6a657de3b6d08dab0617b8a596234fa (container=0574d1fd74bef2e6fc54174e1fbeda25efd7ed270dce1d6dbede4ead19c7c485, name=bridge, type=bridge)
2017-10-13T07:13:47.778855117-07:00 container start 0574d1fd74bef2e6fc54174e1fbeda25efd7ed270dce1d6dbede4ead19c7c485 (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=xcmylcwlag5vot4tp3l5z6oam, com.docker.swarm.task.name=web.3.xcmylcwlag5vot4tp3l5z6oam, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.3.xcmylcwlag5vot4tp3l5z6oam, vendor=CentOS)
```
+
The list of events shown here are `container create`, `network connect`, and `container start`.
=== Use filters
The list of events can be restricted by filters specified using `--filter` or `-f` option. The currently supported filters are:
. container (`container=`)
. daemon (`daemon=`)
. event (`event=`)
. image (`image=`)
. label (`label=` or `label==`)
. network (`network=`)
. plugin (`plugin=`)
. type (`type=`)
. volume (`volume=`)
Let's look at the list of running containers first using `docker container ls`, and then learn how to apply these filters.
Here is the list of running containers from the service:
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
074447f26452 jboss/wildfly:latest "/opt/jboss/wildfl..." 3 minutes ago Up 3 minutes 8080/tcp web.1.ytyv0gqi7dzxtetssrlsgvvbu
0574d1fd74be jboss/wildfly:latest "/opt/jboss/wildfl..." 8 minutes ago Up 8 minutes 8080/tcp web.3.xcmylcwlag5vot4tp3l5z6oam
55198043b6aa jboss/wildfly:latest "/opt/jboss/wildfl..." 25 minutes ago Up 25 minutes 8080/tcp web.2.1ic0vevvvu2nwwyc6css58ref
```
Let's apply the filters.
. Show events for a container by name
.. In T1, give the command to listen to a specific container as:
+
```
docker system events -f container=web.1.ytyv0gqi7dzxtetssrlsgvvbu
```
+
You may have to terminate previous run of `docker system events` using `Ctrl` + `C` to give this new command.
+
.. In T2, terminate the second replica of the service as `docker container rm -f web.2.1ic0vevvvu2nwwyc6css58ref`.
.. T1 does not show any events because its only listening for events from the first replica of the service.
. Show events for an event
.. In T1, give the command `docker system events -f event=create`.
.. In T2, scale the service by one more replica:
+
```
docker service scale web=4
```
.. T1 shows the event for container creation
+
```
2017-10-13T07:24:22.971050949-07:00 container create 84e4604ffd983cfcc53ad619b4c11156518834fe23e4a0a8b299905b978a0022 (build-date=20170911, com.docker.swarm.node.id=wgujclh0492kkszpil81d3ugb, com.docker.swarm.service.id=r4i0x8ujnn2q8osj8dowgvw72, com.docker.swarm.service.name=web, com.docker.swarm.task=, com.docker.swarm.task.id=38unfmcsxmnvr844gysn28lwa, com.docker.swarm.task.name=web.4.38unfmcsxmnvr844gysn28lwa, image=jboss/wildfly:latest@sha256:d3af084d024753e4799809c10cd188f675a5b254a8e279b34709035b95d27dc7, license=GPLv2, name=web.4.38unfmcsxmnvr844gysn28lwa, vendor=CentOS)
```
+
This is accurate as a new container is created and the event is shown in T1 console.
.. In T2, scale the service back to 2 using the command `docker servie scale web=2`
.. T1 does not show any additional events because its only looking for create events
.. More samples are explained at https://docs.docker.com/engine/reference/commandline/events/#/filter-events-by-criteria.
== Prometheus
https://prometheus.io/[Prometheus] is an open-source systems monitoring and alerting toolkit. Prometheus collects metrics from monitored targets by scraping metrics from HTTP endpoints on these targets. Docker instance can be configured as Prometheus target.
Different targets to scrape are defined in the https://prometheus.io/docs/operating/configuration/[Prometheus configuration file]. Targets may be statically configured via the `static_configs` parameter in the configuration fle or dynamically discovered using one of the supported service-discovery mechanisms (Consul, DNS, Etcd, etc.).
Prometheus collects metrics from monitored targets by scraping metrics from HTTP endpoints on these targets. Since Prometheus also exposes data in the same manner about itself, it can also scrape and monitor its own health.
=== Docker metrics for Prometheus
Docker exposes Prometheus-compatible metrics on port `9323`. This support is only available as an experimental feature.
. For Docker for Mac, click on Docker icon in the status menu
. Select `Preferences...`, `Daemon`, `Advanced` tab
. Update daemon settings:
+
```
{
"metrics-addr" : "0.0.0.0:9323",
"experimental" : true
}
```
+
. Click on `Apply & Restart` to restart the daemon
+
image::prometheus-metrics-config.png[]
+
. Show the complete list of metrics using `curl http://localhost:9323/metrics`
. Show the list of engine metrics using `curl http://localhost:9323/metrics | grep engine`
==== Start Prometheus
In this section, we'll start Prometheus and use it to scrape it's own health.
. Create a new directory `prometheus` and change to that directory
. Create a text file `prometheus.yml` and use the following content
+
```
# A scrape configuration scraping a Node Exporter and the Prometheus server
# itself.
scrape_configs:
# Scrape Prometheus itself every 5 seconds.
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
```
+
This configuration file scrapes data from the Prometheus container which will be started subsequently on port 9090.
+
. Start a single-replica Prometheus service:
+
```
docker service create \
--replicas 1 \
--name metrics \
--mount type=bind,source=`pwd`/prometheus.yml,destination=/etc/prometheus/prometheus.yml \
--publish 9090:9090/tcp \
prom/prometheus
```
+
This will start the Prometheus container on port 9090.
+
. Prometheus dashboard is at http://localhost:9090. Check the list of enabled targets at http://localhost:9090/targets (also accessible from `Status` -> `Targets` menu).
+
image::prometheus-metrics-target.png[]
+
It shows that the Prometheus endpoint is available for scraping.
+
. Click on `Graph` and click on `-insert metric at cursor-` to see the list of metrics available:
+
image::prometheus-metrics1.png[]
+
These are all the metrics published by the Prometheus endpoint.
+
. Choose `http_request_total` metrics, click on `Execute`
+
image::prometheus-metrics2.png[]
+
. Switch from `Console` to `Graph`
+
image::prometheus-metrics3.png[]
+
. Change the duration from `1h` to `5m`
+
image::prometheus-metrics4.png[]
+
. Click on `Add Graph`, select a different metric, say `http_requests_duration_microseconds`, and click on `Execute`
+
image::prometheus-metrics5.png[]
+
. Switch from `Console` to `Graph` and change the duration from `1h` to `5m`
+
image::prometheus-metrics6.png[]
+
. Stop the container: `docker container rm -f metrics`
Multiple graphs can be added this way.
=== Node health
In this section, we'll start Prometheus node exporter that will publish machine metrics. Then we'll use Prometheus to scrape its health information about the node running Docker.
==== Start Node Exporter
. All containers need to use the same overlay network so that they can communicate with each other. Let's create an overlay network:
+
```
docker network create --driver overlay prom
```
+
. Start Prometheus node exporter:
+
```
docker service create --name node \
--mode global \
--mount type=bind,source=/proc,target=/host/proc \
--mount type=bind,source=/sys,target=/host/sys \
--mount type=bind,source=/,target=/rootfs \
--network prom \
--publish 9100:9100 \
prom/node-exporter:v0.15.0 \
--path.procfs /host/proc \
--path.sysfs /host/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
```
+
A few observations in this command:
+
.. This is started as a global service such that it is started on all nodes of the cluster.
.. As explained in https://github.com/prometheus/node_exporter/issues/610, node exporter only works with host network on Mac OSX. This is not needed if you are running on Linux.
.. It uses the overlay network previously created.
.. It needs access to host's filesystems such that the metrics about the node can be published.
==== Restart Prometheus
. Update `prometheus.yml` to the following text:
+
```
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets:
- 'localhost:9090'
- job_name: 'node resources'
dns_sd_configs:
- names: ['tasks.node']
type: 'A'
port: 9100
params:
collect[]:
- cpu
- meminfo
- diskstats
- netdev
- netstat
- job_name: 'node storage'
scrape_interval: 1m
dns_sd_configs:
- names: ['tasks.node']
type: 'A'
port: 9100
params:
collect[]:
- filefd
- filesystem
- xfs
```
+
A few observations:
+
.. DNS-based service discovery is used to discover the scraper for node-exporter. This is further explained at https://prometheus.io/docs/operating/configuration/#[dns_sd_configs]. A record-based queries are used to discover the service.
.. Two different jobs are created even though they are scraping from the same endpoint. This provides a more logical way to represent data.
+
. Terminate previously running Prometheus service:
+
```
docker service rm metrics
```
+
. Restart the Prometheus service, this time using the overlay network, as:
+
```
docker service create \
--replicas 1 \
--name metrics \
--network prom \
--mount type=bind,source=`pwd`/prometheus.yml,destination=/etc/prometheus/prometheus.yml \
--publish 9090:9090/tcp \
prom/prometheus
```
==== Check metrics
. Confirm that both the services have started:
+
```
ID NAME MODE REPLICAS IMAGE PORTS
lzl41s2i66jd metrics replicated 1/1 prom/prometheus:latest *:9090->9090/tcp
dro3ncpyuchp node global 1/1 prom/node-exporter:latest
```
+
. Confirm that all the targets are configured correctly at http://localhost:9090/targets[Prometheus dashboard]:
+
image::prometheus-metrics-target2.png[]
+
. Now a lot more metrics, this time from the node, are also available:
+
image::prometheus-metrics7.png[]
+
Console output and graphs for all these metrics is now available:
+
image::prometheus-metrics8.png[]
+
Complete list of metrics is available at https://github.com/prometheus/node_exporter.
=== Query using PromQL (TODO)
Add some fun queries from https://prometheus.io/docs/querying/basics/.
== cAdvisor
https://github.com/google/cadvisor[cAdvisor] (Container Advisor) provides resource usage and performance characteristics running containers. Let's take a look on how cAdvisor can be used to get these metrics from containers.
. Run `cAdvisor`
+
```
docker container run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor:latest
```
+
. Dashboard is available at http://localhost:8080
+
image::cadvisor-default-dashboard.png[]
+
. A high-level CPU and Memory utilization is shown. More details about CPU, memory, network and filesystem usage is shown in the same page. CPU usage looks like as shown:
+
image::cadvisor-cpu-snapshot.png[]
+
. All Docker containers are in `/docker` sub-container.
+
image::cadvisor-docker-metrics.png[]
+
Click on any of the containers and see more details about the container.
cAdvisor samples once a second and has historical data for only one minute. The data generated from https://github.com/google/cadvisor/blob/master/docs/storage/influxdb.md[cAdvisor can be exported to InfluxDB]. Optionally, you may use a Grafana front end to visualize the data as explained in https://www.brianchristner.io/how-to-setup-docker-monitoring/[How to setup Docker monitoring].
=== Prometheus and cAdvisor
cAdvisor also exposes container statistics as Prometheus metrics out of the box. By default, these metrics are served under the `/metrics` HTTP endpoint. Let's take a look at how these container metrics can be observed using Prometheus.
. Terminate previously running cAdvisor:
+
```
docker container rm -f cadvisor
```
+
. Start a new cAdvisor service, using the `prom` overlay network created earlier:
+
```
docker service create \
--name cadvisor \
--network prom \
--mode global \
--mount type=bind,source=/,target=/rootfs \
--mount type=bind,source=/var/run,target=/var/run \
--mount type=bind,source=/sys,target=/sys \
--mount type=bind,source=/var/lib/docker,target=/var/lib/docker \
google/cadvisor:latest
```
+
. Terminate the previously running Prometheus service:
+
```
docker service rm metrics
```
+
. The update `prometheus.yml` configuration file is:
+
```
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets:
- 'localhost:9090'
- job_name: 'node resources'
dns_sd_configs:
- names: ['tasks.node']
type: 'A'
port: 9100
params:
collect[]:
- cpu
- meminfo
- diskstats
- netdev
- netstat
- job_name: 'node storage'
scrape_interval: 1m
dns_sd_configs:
- names: ['tasks.node']
type: 'A'
port: 9100
params:
collect[]:
- filefd
- filesystem
- xfs
- job_name: 'cadvisor'
dns_sd_configs:
- names: ['tasks.cadvisor']
type: 'A'
port: 8080
```
+
. Start the new Prometheus service
+
```
docker service create \
--replicas 1 \
--name metrics \
--network prom \
--mount type=bind,source=`pwd`/prometheus.yml,destination=/etc/prometheus/prometheus.yml \
--publish 9090:9090/tcp \
prom/prometheus
```
+
. Confirm that all the targets are configured correctly at http://localhost:9090/targets[Prometheus dashboard]:
+
image::prometheus-metrics-target3.png[]
+
Note, all four scrape endpoints are shown here.
+
. In Graphs, now, a lot more metrics, this time from cAdvisor, are also available:
+
image::prometheus-metrics9.png[]
+
Console output and graphs for all these metrics is now available:
+
image::prometheus-metrics10.png[]
+
Complete list of metrics is available at https://github.com/google/cadvisor.
Here is a basic query written using https://prometheus.io/docs/querying/basics/[PromQL] worth trying:
```
sum by (container_label_com_docker_swarm_node_id) (
irate(
container_cpu_usage_seconds_total{
container_label_com_docker_swarm_service_name="metrics"
}[1m]
)
)
```
This shows the average amount of CPU used per minute by the service `metrics` aggregated over multiple CPUs. The graph will look as shown:
image::prometheus-metrics11.png[]
== Monitor Java Applications
This section will explain how an existing Java application can be updated to publish metrics and monitored by Prometheus.
Prometheus collects metrics from monitored targets by scraping metrics HTTP endpoints on these targets.
As discussed earlier, Prometheus collects metrics from monitored targets by scraping from an HTTP endpoint on these targets. By default, these metrics are expected to be published at `/metrics`. Any existing Java application can be updated to publish Prometheus-style metrics at this endpoint.
An link:ch05-compose.adoc#configuration-file[earlier chapter] explained a simple Java EE application that talks to a MySQL database. This application also publishes Prometheus-style metrics for the underlying JVM at `/metrics`. It also publishes application-specific metrics such as total number of times `GET /` and `GET /{id}` is called.
The complete set of JVM metrics are explained at https://github.com/prometheus/client_java. Refer to https://github.com/arun-gupta/docker-javaee/tree/master/employees/src/main/java/org/javaee/samples/employees/metrics for more details on how these metrics are enabled.
=== Start Java application
. Use the link:ch05-compose.adoc#configuration-file[Compose file] to deploy a simple the Java EE application. This will start WildFly Swarm application and MySQL database.
+
docker stack deploy --compose-file=docker-compose.yml webapp
+
This will create `webapp_default` overlay network, and start the `webapp_web` and `webapp_db` services.
+
. Verify the network:
+
```
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
u6ybdaqx5h5y webapp_default overlay swarm
```
+
Other networks may be shown here as well.
+
. Verify the services:
+
```
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
ucztcpf1vw0a webapp_db replicated 1/1 mysql:8 *:3306->3306/tcp
jttfgvr09kre webapp_web replicated 1/1 arungupta/docker-javaee:latest *:8080->8080/tcp,*:9990->9990/tcp
```
+
. Verify that the endpoint is accessible:
+
```
$ curl http://localhost:8080/resources/employees
1Penny2Sheldon3Amy4Leonard5Bernadette6Raj7Howard8Priya
```
+
. Access the metrics published by the endpoint using `curl http://localhost:8080/metrics` to see the output:
+
```
# HELP jvm_info JVM version info
# TYPE jvm_info gauge
jvm_info{version="1.8.0_141-8u141-b15-1~deb9u1-b15",vendor="Oracle Corporation",} 1.0
# HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds.
# TYPE jvm_gc_collection_seconds summary
jvm_gc_collection_seconds_count{gc="PS Scavenge",} 25.0
jvm_gc_collection_seconds_sum{gc="PS Scavenge",} 0.386
jvm_gc_collection_seconds_count{gc="PS MarkSweep",} 6.0
jvm_gc_collection_seconds_sum{gc="PS MarkSweep",} 0.546
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 25.5
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.508056592419E9
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 499.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1048576.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 4.244393984E9
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 5.06601472E8
# HELP jvm_classes_loaded The number of classes that are currently loaded in the JVM
# TYPE jvm_classes_loaded gauge
jvm_classes_loaded 13096.0
# HELP jvm_classes_loaded_total The total number of classes that have been loaded since the JVM has started execution
# TYPE jvm_classes_loaded_total counter
jvm_classes_loaded_total 13096.0
# HELP jvm_classes_unloaded_total The total number of classes that have been unloaded since the JVM has started execution
# TYPE jvm_classes_unloaded_total counter
jvm_classes_unloaded_total 0.0
# HELP jvm_threads_current Current thread count of a JVM
# TYPE jvm_threads_current gauge
jvm_threads_current 60.0
# HELP jvm_threads_daemon Daemon thread count of a JVM
# TYPE jvm_threads_daemon gauge
jvm_threads_daemon 12.0
# HELP jvm_threads_peak Peak thread count of a JVM
# TYPE jvm_threads_peak gauge
jvm_threads_peak 67.0
# HELP jvm_threads_started_total Started thread count of a JVM
# TYPE jvm_threads_started_total counter
jvm_threads_started_total 93.0
# HELP jvm_threads_deadlocked Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers
# TYPE jvm_threads_deadlocked gauge
jvm_threads_deadlocked 0.0
# HELP jvm_threads_deadlocked_monitor Cycles of JVM-threads that are in deadlock waiting to acquire object monitors
# TYPE jvm_threads_deadlocked_monitor gauge
jvm_threads_deadlocked_monitor 0.0
# HELP jvm_memory_bytes_used Used bytes of a given JVM memory area.
# TYPE jvm_memory_bytes_used gauge
jvm_memory_bytes_used{area="heap",} 1.2072508E8
jvm_memory_bytes_used{area="nonheap",} 9.3550048E7
# HELP jvm_memory_bytes_committed Committed (bytes) of a given JVM memory area.
# TYPE jvm_memory_bytes_committed gauge
jvm_memory_bytes_committed{area="heap",} 2.69484032E8
jvm_memory_bytes_committed{area="nonheap",} 1.0133504E8
# HELP jvm_memory_bytes_max Max (bytes) of a given JVM memory area.
# TYPE jvm_memory_bytes_max gauge
jvm_memory_bytes_max{area="heap",} 4.66092032E8
jvm_memory_bytes_max{area="nonheap",} -1.0
# HELP jvm_memory_pool_bytes_used Used bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_used gauge
jvm_memory_pool_bytes_used{pool="Code Cache",} 1.4589888E7
jvm_memory_pool_bytes_used{pool="Metaspace",} 6.9998048E7
jvm_memory_pool_bytes_used{pool="Compressed Class Space",} 8962112.0
jvm_memory_pool_bytes_used{pool="PS Eden Space",} 2.3732032E7
jvm_memory_pool_bytes_used{pool="PS Survivor Space",} 6073592.0
jvm_memory_pool_bytes_used{pool="PS Old Gen",} 9.0919456E7
# HELP jvm_memory_pool_bytes_committed Committed bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_committed gauge
jvm_memory_pool_bytes_committed{pool="Code Cache",} 1.47456E7
jvm_memory_pool_bytes_committed{pool="Metaspace",} 7.5800576E7
jvm_memory_pool_bytes_committed{pool="Compressed Class Space",} 1.0788864E7
jvm_memory_pool_bytes_committed{pool="PS Eden Space",} 9.2274688E7
jvm_memory_pool_bytes_committed{pool="PS Survivor Space",} 3.8797312E7
jvm_memory_pool_bytes_committed{pool="PS Old Gen",} 1.38412032E8
# HELP jvm_memory_pool_bytes_max Max bytes of a given JVM memory pool.
# TYPE jvm_memory_pool_bytes_max gauge
jvm_memory_pool_bytes_max{pool="Code Cache",} 2.5165824E8
jvm_memory_pool_bytes_max{pool="Metaspace",} -1.0
jvm_memory_pool_bytes_max{pool="Compressed Class Space",} 1.073741824E9
jvm_memory_pool_bytes_max{pool="PS Eden Space",} 9.699328E7
jvm_memory_pool_bytes_max{pool="PS Survivor Space",} 3.8797312E7
jvm_memory_pool_bytes_max{pool="PS Old Gen",} 3.49700096E8
```
+
It shows all the JVM metrics that are published by the https://github.com/prometheus/client_java[Prometheus JVM Client]. The metrics generated by the application are not shown yet. It requires for the application to be accessed first.
Let's access the JVM metrics in Prometheus dashboard first, and then we'll access the app to show app-specific metrics.
=== Start Prometheus service
. Make sure to terminate any previously running Prometheus endpoints:
+
docker service rm metrics
+
. Create a directory `prometheus` and change into that directory.
. Create a text file `prometheus.yml` and add the following content:
+
```
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'webapp'
dns_sd_configs:
- names: ['tasks.webapp_web']
type: 'A'
port: 8080
```
+
This defines the configuration for the HTTP endpoint that publishes Prometheus-style metrics from the Java application.
+
. Start Prometheus service:
+
```
docker service create \
--replicas 1 \
--network webapp_default \
--name metrics \
--mount type=bind,source=`pwd`/prometheus.yml,destination=/etc/prometheus/prometheus.yml \
--publish 9090:9090 \
prom/prometheus
```
+
Note, this service is using the `webapp_default` overlay network that is created when the application stack was deployed.
+
. Access Prometheus dashboard at http://localhost:9090
. Check the configured targets at http://localhost:9090/targets:
+
image::prometheus-metrics-target4.png[]
+
It shows that the application metrics HTTP endpoint is configured as a Prometheus target.
=== View application metrics
. On Prometheus dashboard, click on `-insert metric at cursor-` to see the list of metrics available:
+
image::prometheus-metrics12.png[]
+
JVM metrics shown earlier are displayed here as well.
+
. Select `jvm_memory_pool_bytes_used` metric and click on `Execute` to view the metric.
+
image::prometheus-metrics13.png[]
+
. Select `Graph` to view the graphical representation
+
image::prometheus-metrics14.png[]
+
. Now access the application using `curl http://localhost:8080/resources/employees` a few times.
. Refresh Prometheus dashboard and see the updated list of metrics:
+
image::prometheus-metrics15.png[]
+
Note, `app*` and `requests*` that are generated by the application.
+
. Select `requests_get_all` metric and view the graph:
+
image::prometheus-metrics16.png[]
+
. Access the application a few times using `curl http://localhost:8080/resources/employees/5` and then watch the `requests_get_one` metric.
== Grafana
https://github.com/grafana/grafana[Grafana] is an open source metric analytics & visualization suite. It supports many different storage backends, called as Data Source. Prometheus can be added as Grafana data source. It even provides support for runnning Prometheus queries from the Grafana dashboard as well. More details can be found in http://docs.grafana.org/features/datasources/prometheus/[Using Prometheus in Grafana].
=== Start Grafana
This section will explain how to start Grafana, use Prometheus as the data source, and view some container metrics.
. Start Grafana:
+
```
docker container run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_SECURITY_ADMIN_PASSWORD=secret" \
grafana/grafana
```
+
Use the login name `admin` and password `secret`.
+
Read more details about different http://docs.grafana.org/installation/configuration/[configuration options].
+
. Access Grafana dashboard at http://localhost:3000. Use the login and password as credentials to see Grafana console.
+
image::grafana-metrics1.png[]
=== Add Prometheus as data source
. Click the `Add data source` button in the top header.
. Specify the parameters as shown:
+
image::grafana-metrics2.png[]
+
. Click on `Add` to test and save the data source:
+
image::grafana-metrics3.png[]
+
The green bar indicates that the data source was added successfully.
=== Create chart with Prometheus data source
. Click on `Create your first dashboard`, save it and give it a name, say `Docker and Java dashboard`
. Click on `Graph`, edit, under the `Metrics` tab, select your Prometheus data source.
. Enter the following Prometheus query expressions in the query field. The graphs will referesh in a few seconds and will look like as shown:
+
image::grafana-metrics4.png[]
================================================
FILE: Docker/additional-ressources/developer-tools/java/chapters/ch11-bigdata.adoc
================================================
:toc:
:imagesdir: images
= Big Data Processing with Docker and Hadoop
*PURPOSE*: This chapter explains how to use Docker to create a Hadoop cluster and a Big Data application in Java. It highlights several concepts like service scale, dynamic port allocation, container links, integration tests, debugging, etc.
Big Data applications usually involve distributed processing using tools like Hadoop or Spark. These services can be scaled up, running with several nodes to support more parallelism. Running tools like Hadoop and Spark on Docker makes it easy to scale them up and down. This is very useful to simulate a cluster on development time and also to run integration tests before taking your application to production.
The application on this example reads a file, count how many words are on that file using a MapReduce job implemented on Hadoop and then saves the result on a MongoDB database. In order to do that, we will run a Hadoop cluster and a MongoDB server on Docker.
[NOTE]
====
http://hadoop.apache.org/[Apache Hadoop] is an open-source software framework used for distributed storage and processing of big data sets using the MapReduce programming model. The core of Apache Hadoop consists of a storage part, known as Hadoop Distributed File System (HDFS), and a processing part which is a MapReduce programming model. Hadoop splits files into large blocks and distributes them across nodes in a cluster. It then transfers packaged code into nodes to process the data in parallel. The Hadoop framework itself is mostly written in Java.
====
== Clone the sample application
Clone the project at `https://github.com/fabianenardon/hadoop-docker-demo`
Inspect the `sample/docker/docker-compose.yml` file. It defines a MongoDB service and the services needed to run a Hadoop cluster. It also defines a service for our application. See how the services are linked together.
== Build the application
[source, text]
----
cd sample
mvn clean install -Papp-docker-image
----
In the command above, `-Papp-docker-image` will fire up the `app-docker-image` profile, defined in the application `pom.xml`. This profile will create a dockerized version of the application, creating two images:
. `docker-hadoop-example`: docker image used to run the application
. `docker-hadoop-example-tests`: docker image used to run integration tests
== Start all the services
Go to the `sample/docker` folder and start the services:
cd docker
docker-compose up -d
See the logs and wait until everything is up:
docker-compose logs -f
Here is a sample output:
```
Attaching to docker_nodemanager_1, docker-hadoop-example, yarn, secondarynamenode, docker_datanode_1, namenode, mongo
docker-hadoop-example | Usage: hdfs [--config confdir] [--loglevel loglevel] COMMAND
docker-hadoop-example | where COMMAND is one of:
. . .
nodemanager_1 | 17/10/11 18:26:27 INFO nodemanager.NodeManager: STARTUP_MSG:
docker-hadoop-example | zkfc run the ZK Failover Controller daemon
nodemanager_1 | /************************************************************
docker-hadoop-example | datanode run a DFS datanode
nodemanager_1 | STARTUP_MSG: Starting NodeManager
docker-hadoop-example | dfsadmin run a DFS admin client
datanode_1 | 17/10/11 18:26:25 INFO datanode.DataNode: STARTUP_MSG:
nodemanager_1 | STARTUP_MSG: host = db2d63621ba4/172.23.0.8
namenode | FORMATTING NAMENODE
. . .
secondarynamenode | STARTUP_MSG: Starting SecondaryNameNode
datanode_1 | STARTUP_MSG: build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r b165c4fe8a74265c792ce23f546c64604acf0e41; compiled by 'jenkins' on 2016-01-26T00:08Z
docker-hadoop-example | oev apply the offline edits viewer to an edits file
namenode | STARTUP_MSG: build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r b165c4fe8a74265c792ce23f546c64604acf0e41; compiled by 'jenkins' on 2016-01-26T00:08Z
nodemanager_1 | 17/10/11 18:26:27 INFO nodemanager.NodeManager: registered UNIX signal handlers for [TERM, HUP, INT]
secondarynamenode | STARTUP_MSG: host = secondarynamenode/172.23.0.5
datanode_1 | STARTUP_MSG: java = 1.8.0_112
. . .
namenode | 17/10/11 18:27:31 INFO namenode.TransferFsImage: Transfer took 0.00s at 0.00 KB/s
namenode | 17/10/11 18:27:31 INFO namenode.TransferFsImage: Downloaded file fsimage.ckpt_0000000000000000015 size 946 bytes.
namenode | 17/10/11 18:27:31 INFO namenode.NNStorageRetentionManager: Going to retain 2 images with txid >= 0
secondarynamenode | 17/10/11 18:27:32 INFO namenode.TransferFsImage: Uploaded image with txid 15 to namenode at http://namenode:50070 in 0.115 seconds
secondarynamenode | 17/10/11 18:27:32 WARN namenode.SecondaryNameNode: Checkpoint done. New Image Size: 946
```
In order to see if everything is up, open `http://localhost:8088/cluster`. You should see 1 active node when everything is up and running.
image::docker-bigdata-03.png[]
== Running the application
This application reads a text file from HDFS and counts how many words it has. The result is saved on MongoDB.
First, create a folder on HDFS. We will save the file to be processed on it:
docker-compose exec yarn hdfs dfs -mkdir /files/
In the command above, we are executing `hdfs dfs -mkdir /files/` on the service `yarn`. This command creates a new folder called `/files/` on HDFS, the distributed file system used by Hadoop.
Put the file we are going to process on HDFS:
[source, text]
----
docker-compose run docker-hadoop-example \
hdfs dfs -put /maven/test-data/text_for_word_count.txt /files/
----
The `text_for_word_count.txt` file was added to the application image by maven when we built it, so we can use it to test. The command above will transfer the `text_for_word_count.txt` file from the local disk to the `/files/` folder on HDFS, so the Hadoop process can access it.
Run our application
[source, text]
----
docker-compose run docker-hadoop-example \
hadoop jar /maven/jar/docker-hadoop-example-1.0-SNAPSHOT-mr.jar \
hdfs://namenode:9000 /files mongo yarn:8050
----
The command above will run our jar file on the Hadoop cluster. The `hdfs://namenode:9000` parameter is the HDFS address. The `/files` parameter is where the file to process can be found on HDFS. The `mongo` parameter is the MongoDB host address. The `yarn:8050` parameter is the Hadoop yarn address, where the MapReduce job will be deployed. Note that since we are running the Hadoop components (namenode, yarn), MongoDB and our application as Docker services, they can all find each other and we can use the service names as host addresses.
If you go to `http://localhost:8088/cluster`, you can see your job running. When the job finishes, you should see this:
image::docker-bigdata-04.png[]
If everything ran successful, you should be able to see the results on MongoDB.
Connect to the Mongo container:
docker-compose exec mongo mongo
When connected, type:
[source, text]
----
use mongo_hadoop
db.word_count.find();
----
You should see the results of running the application. Something like this:
[source, text]
----
> db.word_count.find();
{ "_id" : "Counts on Sat Mar 18 18:16:20 UTC 2017", "words" : 256 }
----
== Scaling the Hadoop cluster
If you want, you can scale your cluster, adding more Hadoop nodes to it:
docker-compose scale nodemanager=2
This means that you want to have 2 nodes in your Hadoop cluster. Go to `http://localhost:8088/cluster` and refresh until you see 2 active nodes.
The trick to scale the nodes is to use dynamically allocated ports and let docker assign a different port to each new nodemanager. See this approach in this snippet of the `docker-compose.yml` file:
[source, text]
----
nodemanager:
image: tailtarget/hadoop:2.7.2
command: yarn nodemanager
ports:
- "8042" # local port dynamically assigned. allows node to be scaled up and down
links:
- namenode
- datanode
- yarn
hostname: nodemanager
----
== Stopping the services
Stop all the services
docker-compose down
Note that since our `docker-compose.yml` file defines volume mappings for HDFS and MongoDB, next time you start the services again, your data will still be there.
== Debugging your code
Debugging distributed Hadoop applications can be cumbersome. However, you can configure your environment to use the docker Hadoop cluster and debug your code easily from an IDE.
First, make sure your services are up:
docker-compose up -d
Then, add this to your `/etc/hosts`:
[source, text]
----
127.0.0.1 datanode
127.0.0.1 yarn
127.0.0.1 namenode
127.0.0.1 secondarynamenode
127.0.0.1 nodemanager
----
This configuration will allow you to access the docker Hadoop cluster from your IDE.
Then, open your project from https://github.com/fabianenardon/hadoop-docker-demo in Netbeans (or any other IDE) and run the application file:
image::docker-bigdata-01.png[]
Note that you will be connecting to the docker services at localhost.
You can also set a breakpoint in your application and debug:
image::docker-bigdata-02.png[]
image::docker-bigdata-05.png[]
Shutdown the services:
docker-compose down
== Integration tests
When running integration tests, you want to test your application in an environment as close to production as possible, so you can test interactions between the several components, services, databases, network communication, etc. Fortunately, docker can help you a lot with integration tests.
There are several strategies to run integration tests, but in this application we are going to use the following:
. Start the services with a `docker-compose.yml` file created for testing purposes. This file won't have any volumes mapped, so when the test is over, no state will be saved. The test `docker-compose.yml` file won't publish any port on the host machine, so we can run simultaneous tests.
. Run the application, using the services started with the `docker-compose.yml` test file.
. Run Maven integration tests to check if the application execution produced the expected results. This will be done by checking what was saved on the MongoDB database.
. Stop the services. No state will be stored, so next time you run the integration tests, you will have a clean environment.
Here is how to execute this strategy, step by step. The complete source code for this is in the `sample` directory of https://github.com/fabianenardon/hadoop-docker-demo.
Start the services with the test configuration:
[source, text]
----
docker-compose --file src/test/resources/docker-compose.yml up -d
----
Make sure all services are started and create the folder we need on hdfs to test:
[source, text]
----
docker-compose --file src/test/resources/docker-compose.yml exec yarn hdfs dfs -mkdir /files/
----
Put the test file on hdfs:
[source, text]
----
docker-compose --file src/test/resources/docker-compose.yml \
run docker-hadoop-example \
hdfs dfs -put /maven/test-data/text_for_word_count.txt /files/
----
Run the application
[source, text]
----
docker-compose --file src/test/resources/docker-compose.yml \
run docker-hadoop-example \
hadoop jar /maven/jar/docker-hadoop-example-1.0-SNAPSHOT-mr.jar \
hdfs://namenode:9000 /files mongo yarn:8050
----
Run our integration tests:
[source, text]
----
docker-compose --file src/test/resources/docker-compose.yml \
run docker-hadoop-example-tests mvn -f /maven/code/pom.xml \
-Dmaven.repo.local=/m2/repository -Pintegration-test verify
----
Stop all the services:
[source, text]
----
docker-compose --file src/test/resources/docker-compose.yml down
----
If you want to remote debug tests, run the tests this way instead:
[source, text]
----
docker run -v ~/.m2:/m2 -p 5005:5005 \
--link mongo:mongo \
--net resources_default \
docker-hadoop-example-tests \
mvn -f /maven/code/pom.xml \
-Dmaven.repo.local=/m2/repository \
-Pintegration-test verify \
-Dmaven.failsafe.debug
----
Running with this configuration, the application will wait until an IDE connects for remote debugging on port 5005.
See more about integration tests in the link:./ch09-cicd.adoc[CI/CD using Docker] chapter
================================================
FILE: Docker/additional-ressources/developer-tools/java/readme.adoc
================================================
= Docker for Java Developers
This tutorial offers Java developers an intro-level and self-paced hands-on workshop with Docker.
* link:chapters/ch01-setup.adoc[Setup Environments]
* link:chapters/ch02-basic-concepts.adoc[Docker Basic Concepts]
* Building
** link:chapters/ch03-build-image.adoc[Build a Docker Image]
** link:chapters/ch03-build-image-java-9.adoc[Build a Docker Image for Java 9]
* link:chapters/ch04-run-container.adoc[Run a Docker Container]
* link:chapters/ch05-compose.adoc[Multi-container application using Docker Compose]
* link:chapters/ch06-swarm.adoc[Multi-container application using Compose and Swarm Mode]
* Java IDEs
** link:chapters/ch07-netbeans.adoc[Docker Tooling in NetBeans]
** link:chapters/ch07-intellij.adoc[Docker Tooling in IntelliJ IDEA]
** link:chapters/ch07-eclipse.adoc[Docker Tooling in Eclipse]
* Multi-container application on multi-host
** link:chapters/ch08-aws.adoc[Docker for AWS]
** link:chapters/ch08-azure.adoc[Docker for Azure] (coming)
** link:chapters/ch08-cloud.adoc[Docker Cloud]
* link:chapters/ch09-cicd.adoc[CI/CD using Docker]
* link:chapters/ch10-monitoring.adoc[Monitoring Docker Containers with Prometheus and Grafana]
* link:chapters/ch11-bigdata.adoc[Big Data Processing with Docker and Hadoop]
* link:chapters/appa-common-commands.adoc[Common Docker Commands]
* link:chapters/appb-troubleshooting.adoc[Troubleshooting]
* link:chapters/appc-references.adoc[References]
================================================
FILE: Docker/additional-ressources/developer-tools/java/scripts/docker-compose-pull-images.yml
================================================
version: '3'
services:
ubuntu:
image: ubuntu:latest
busybox:
image: busybox:latest
openjdk:
image: openjdk:latest
wildfly:
image: jboss/wildfly:latest
javaee7-hol:
image: arungupta/javaee7-hol:latest
docker-javaee:
image: arungupta/docker-javaee:dockerconeu17
mysql:
image: mysql:8
hadoop:
image: tailtarget/hadoop:2.7.2
jenkins:
image: jenkins/jenkins:lts
prometheus:
image: prom/prometheus:latest
node-exporter:
image: prom/node-exporter
cadvisor:
image: google/cadvisor:latest
grafana:
image: grafana/grafana
debian:
image: debian:stable-slim
alpine:
image: alpine:3.6
openjdk-slim:
image: openjdk:9-jdk-slim
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/Eclipse-README.md
================================================
## In-container Java Development: Eclipse
### Pre-requisites
* [Docker for OSX or Docker for Windows](https://www.docker.com/products/docker)
* [Eclipse](http://www.eclipse.org/downloads/) (install Eclipse IDE for Java EE Developers)
* [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
* [Maven for Eclipse](http://www.eclipse.org/m2e/) (see instructions for adding the Maven plug-in to Eclipse)
### Getting Started
On the command line clone the [registration-docker](https://github.com/docker/labs) repository
```
git clone https://github.com/docker/labs
cd labs/developer-tools/java-debugging
```
In Eclipse, import the app directory of that project as an existing maven project
`File`> `Import` Select `Maven`> `Existing Maven Projects`> `Next`

Select the app subdirectory of the directory where you cloned the project.

Select the pom.xml from the app directory, click `Finish`.

### Building the application
The application is a basic Spring MVC application that receives user input from a form, writes the data to a database, and queries the database.
The application is built using Maven. To build the application click on `Run` > `Run configurations`

Select `Maven build` > `New`

Enter a `Name` for the configuration.
Set the base direct of the application `/registration-docker/app`.
Set the `Goals` to `clean install`.
Click `Apply`
Click `Run`

The results of the build will be displayed in the console.

### Running the application
Open a terminal and go to the application directory. Start the application with docker-compose
> docker-compose up
Docker will build the images for Apache Tomcat and MySQL and start the containers. It will also mount the application directory (`./app/target/UserSignup`) as a data volume on the host system to the Tomcat webapps directory in the web server container.
Open a browser window and go to:
'localhost:8080'; you should see the Tomcat home page

When the Tomcat image was built, the user roles were also configured. Click on the `Manager App` button to see the deployed applications. When prompted for username and password, enter `system` and `manager` respectively to log into the Tomcat Web Application Manager page.

You can use the Manager page to `Start`, `Stop`, `Reload` or `Undeploy` web applications.
To go to the application, Click on `/UserSignup` link.

### Debugging the Application
In the application, click on `Signup` to create a new user. Fill out the registration form and click `Submit`

Click `Yes` to confirm.

Test out the login.

Oh no!

#### Configure Remote Debugging
Tomcat supports remote debugging the Java Platform Debugger Architecture (JPDA). Remote debugging was enabled when the tomcat image (registration-webserver) was built.
To configure remote debugging in Eclipse, click on `Run` > `Debug Configurations ...`

Select `Remote Java Application` and click on `Launch New Configuration` icon

Enter a `Name` for the configuration. Select the project using the `browse` button. Click on `Apply` to save the configuration and click on `Debug` to start the debugging connection between Tomcat and Eclipse.

#### Finding the Error
Since the problem is with the password, lets see how the password is set in the User class. In the User class, the setter for password is scrambled using [rot13](https://en.wikipedia.org/wiki/ROT13) before it is saved to the database.

Try registering a new user using the debugger. In Eclipse, change the view or Perspective to the debugger by clicking on `Window` > `Perspective` > `Open Perspective` > `Debug`

Eclipse will switch to the debug perspective. Since we enable remote debugging earlier, you should see the Daemon Threads for Tomcat in the debug window. Set a breakpoint for in the User class where the password is set.

Register a new user with the username of 'Moby' and with 'm0by' as the password, click `Submit`, click `yes`

Eclipse will display the code at the breakpoint and the value of password in the variables window. Note that the value is `m0by`

Click on `resume` or press `F8` to let the code run.

Next, set a breakpoint on the getPassword in the User class to see the value returned for password. You can also toggle off the breakpoint for setPassword.

Try to log into the application. Look at the value for password in the Eclipse variables window, note that it is `z0ol` which is `m0by` using ROT13.

In this MVC application the UserController uses the findByLogin method in the UserServiceImpl class which uses the findByUsername method to retrieve the information from the database. It then checks to see if the password from the form matches the user password. Since the password from the login form is not scrambled using ROT13, it does not match the user password and you cannot log into the application.
To fix this, apply ROT13 to the password by adding an import near the top of the file
```
import com.docker.UserSignup.util.Rot13
```
and replace the contents of `findByLogin` with
```
public boolean findByLogin(String userName, String password) {
User usr = userRepository.findByUserName(userName);
String passwd = Rot13.rot13(password);
if(usr != null && usr.getPassword().equals(passwd)) {
return true;
}
return false;
}
```

Set a breakpoint in UserServiceImpl on the findByLogin method. Log in again and look at the values for the breakpoint. The 'passwd' variable is `z0ol` which matches the password for the user moby.

Continue (`F8`) and you should successfully log in.

================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/Eclipse-README_es.md
================================================
## Desarrollo Java: Eclipse
### Pre-requisitos
* [Docker for OSX or Docker for Windows](https://www.docker.com/products/docker)
* [Eclipse](http://www.eclipse.org/downloads/) (instalar Eclipse IDE para desaroolladores Java EE)
* [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
* [Maven for Eclipse](http://www.eclipse.org/m2e/) (ver instrucciones para agregar Maven plug-in en Eclipse)
### Empezando
En Eclipse, clonar el repositorio [registration-docker](https://github.com/spara/registration-docker.git)
`File`> `Import`
Seleccionar `Git`> `Projects`> `Next`

Seleccionar `Clone URI`> `Next`

Ingresar la [`url del repositorio`](https://github.com/spara/registration-docker.git)> `Next`

`Seleccionar el branch master`> `Next`

`Ingresar destination directory`> `Next`

Seleccionar el asistente de importación, `Import existing Eclipse project`> `Next`

Seleccionar `registration-docker`> `Finish`

### Construyendo la aplicación
La aplicación es una aplicación Spring MVC básica que recibe datos del usuario de un formulario, almacena los datos en la base de datos, y realiza consultas.
La aplicación se construye usando Maven. Para construir la aplicación hacer clic en `Run` > `Run configurations`

Seleccionar `Maven build` > `New`

Ingresar `Name` para la configuración.
Establecer el directorio base de la aplicación `/registration-docker/app`.
Establecer `Goals` a `clean install`.
Clic `Apply`
Clic `Run`

Los resultados del build serán mostrados en la consola.

### Ejecutando la aplicación
Abrir un terminal e ir al directorio de la aplicación. Iniciar la aplicación con docker-compose
> docker-compose up
Docker construirá las imágenes para Apache Tomcat y MySQL e iniciará los contenedores. También, montará el directorio de la aplicación (`./app/target/UserSignup`) como volumen de datos en el host del sistema al directorio webapps Tomcat en el contenedor del servidor web.
Abrir una ventana en el explorador e ir a:
'localhost:8080'; debe ver la página de inicio de Tomcat

Cuando la imagen de Tomcat fue construida, los roles de los usuarios fueron configurados. Clic en el botón `Manager App` para visualizar las aplicaciones desplegadas. Cuando se solicite por usuario y contraseña, ingresar `system` y `manager` respectivamente para entrar a la página de Tomcat Web Application Manager.

Es posible usar la página Manager para `Start`, `Stop`, `Reload` o `Undeploy` aplicaciones web.
Para ir a la aplicación, clic en el link `/UserSignup`.

### Depurando la Aplicación
En la aplicación, clic en `Signup` para crear un nuevo usuario. Completar el formulario de registro y hacer clic en `Submit`

Clic `Yes` para confirmar.

Probar el inicio de sesión.

Oh no!

#### Configurar Depuración Remota
Tomcat soporta depuración remota usando Java Platform Debugger Architecture (JPDA). Debug Remoto fue habilitado cuando la imagen tomcat (registration-webserver) fue construida.
Para configurar la depuración remota en Eclipse, clic en `Run` > `Debug Configurations ...`

Seleccionar `Remote Java Application` y clic en el icono `Launch New Configuration`

Ingresar `Name` para la configuración. Seleccionar el proyecto usando el botón `browse`. Clic en `Apply` para guardar la configuración y clic en `Debug` para iniciar la conexión de debug entre Tomcat y Eclipse.

#### Buscando el Error
Dado que el problema es la contraseña, hay que ver como la contraseña se establece en la clase User. En la clase User, el setter para la contraseña es mezclado usando [rot13](https://en.wikipedia.org/wiki/ROT13) antes de ser almacenado en la base de datos.

Tratar registrando un nuevo usuario usando el depurador. En Eclipse, cambiar la vista o perspectiva del depurador haciendo clic en `Window` > `Perspective` > `Open Perspective` > `Debug`

Eclipse cambiará a la perspectiva debug. Dado que habilitamos el depurador remoto previamente, debes ver los Daemon Threads para Tomcat en la ventana de debug. Establece un punto de interrupción para la clase User donde el password es establecido.

Registrar un nuevo usuario con el usuario de 'Moby' y con 'm0by' como contraseña, clic `Submit`, clic `yes`

Eclipse mostrará el código en el punto de interrupción y el valor de la contraseña en la ventana variables. Observar que el valor es `m0by`

Clic en `resume` o presionar `F8` para permitir ejecutar el código.

A continuación, establecer el punto de interrupción en getPassword en la clase User para ver los valores retornados para la contraseña. También puede cambiar el punto de interrupción para setPassword.

Tratar de acceder a la aplicación. Ver el valor de la contraseña en la ventana variables de Eclipse, observar que es `z0ol` el cual es `m0by` usando ROT13.

En esta aplicación MVC el UserController usa el método findByLogin en la clase UserServiceImpl la cual usa el método findByUsername para recuperar la información de la base de datos. A continuación, verificar que la contraseña del formulario coincide con la contraseña del usuario. Dado que la contraseña del formulario de inicio de sesión no es mezclada usando ROT13, este no coincide con la contraseña del usuario y no es posible acceder a la aplicación.
Para solucionar esto, aplicar ROT13 a la contraseña agregando
```
import com.docker.UserSignup.utit.Rot13
String passwd = Rot13.rot13(password);
```

Establecer un punto de interrupción en UserServiceImpl en el método findByLogin. Iniciar sesión otra vez y verificar los valores para el punto de interrupción. La variable 'passwd' es 'z0ol' la cual coincide con la contraseña para el usuario moby.

Continuar (`F8`) y debe acceder exitosamente.

================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/IntelliJ-README.md
================================================
## In-container Java Development: IntelliJ Community Edition
### Pre-requisites
* [Docker for OSX or Docker for Windows](https://www.docker.com/products/docker)
* [IntelliJ Community Edition](https://www.jetbrains.com/idea/download/)
* [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
### Getting Started
In IntelliJ, clone the repository. Click on `Check out from Version Control` > `Github`

If this the first time to use IntelliJ with Github, log into your Github account.

On the command line clone the [docker/labs](https://github.com/docker/labs) repository

Click on `Import project from external model`, select `Maven`. Click `Next`

Check `Search for projects recursively`. Click `Next`

Select the project and click `Next`

Select the JDK(set the `JDK home path`) and click `Next`

Click `Finish`

Click on `Project View` to open the project.

### Building the application
The application is a basic Spring MVC application that receives user input from a form, writes the data to a database, and queries the database.
The application is built using Maven. To build the application click on icon on the bottom left of the IntelliJ window and select `Maven Projects`.

The `Maven Projects` window will open on the right side. Maven goals of `clean` and `install` need to be set to build the application.
To set the `clean` goal, click on `Lifecycle` to display the tree of goals. Right click on `clean` and select `Create 'UserSignup [clean]'...`

Click `OK` in the `Create Run/Debug Configuration` window.

Configure the `install` goal similarly. Click on `install` in the Lifecycle tree. Select `Create 'UserSignup[install]'...`

Click `OK` in the `Create Run/Debug Configuration` window.

To build the application run `clean`

Then run `install`

When the application builds, you will see a success message in the log window.

### Running the application
Open a terminal and go to the application directory. Start the application with docker-compose
> docker-compose up
Docker will build the images for Apache Tomcat and MySQL then start the containers. It will also mount the application directory (`./app/target/UserSignup`) as a data volume on the host system to the Tomcat webapps directory in the web server container.
Open a browser window and go to:
'localhost:8080'; you should see the Tomcat home page

When the Tomcat image was built, the user roles were also configured. Click on the `Manager App` button to see the deployed applications. When prompted for username and password, enter `system` and `manager` respectively to log into the Tomcat Web Application Manager page.

You can use the Manager page to `Start`, `Stop`, `Reload` or `Undeploy` web applications.
To go to the application, Click on `/UserSignup` link.

### Debugging the Application
In the application, click on `Signup` to create a new user. Fill out the registration form and click `Submit`

Click `Yes` to confirm.

Test out the login.

Oh no!

#### Configure Remote Debugging
Tomcat supports remote debugging the Java Platform Debugger Architecture (JPDA). Remote debugging was enabled when the tomcat image (registration-webserver) was built.
To configure remote debugging in IntelliJ, click on `Run` > `Edit Configuration ...`

Add a new remote configuration.

In the `Run\Debug Configurations` window, set the `Name` of the configuration as `docker tomcat` and in `Settings` set the port to '8000' as the default Tomcat JPDA debuging port. Click on `OK` to save the configuration.

#### Finding the Error
Since the problem is with the password, let's see how the password is set in the User class. In the User class, the setter for password is scrambled using [rot13](https://en.wikipedia.org/wiki/ROT13) before it is saved to the database.

Try registering a new user using the debugger. In the menu click on `Run` > `Debug...`

Choose the remote Tomcat debug configuration. The Debugger console will be displayed at the bottom of the IntelliJ window.

Set a breakpoint in the User class where the password is set.

Register a new user with the username of 'Moby' and with 'm0by' as the password, click `Submit`, click `yes`

IntelliJ will display the code at the breakpoint and the value of password in the variables window. Note that the value is `m0by`

Click on `Resume Program` to let the code run or press `F8` to step over the breakpoint.

Next, set a breakpoint on the getPassword in the User class to see the value returned for password. You can also toggle off the breakpoint for setPassword.

Try to log into the application. Look at the value for password in the debugging console, note that it is `z0ol` which is `m0by` using ROT13.

In this MVC application the UserController uses the findByLogin method in the UserServiceImpl class which uses the findByUsername method to retrieve the information from the database. It then checks to see if the password from the form matches the user password. Since the password from the login form is not scrambled using ROT13, it does not match the user password and you cannot log into the application.
To fix this, apply ROT13 to the password by adding
```
import com.docker.UserSignup.utit.Rot13
String passwd = Rot13.rot13(password);
```

Set a breakpoint in UserServiceImpl on the findByLogin method. Log in again and look at the values for the breakpoint. The 'passwd' variable is `z0ol` which matches the password for the user moby.

Continue (`F8`) and you should successfully log in.

================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/IntelliJ-README_es.md
================================================
## Desarrollo Java en Contenedor: IntelliJ Community Edition
### Pre-requisitos
* [Docker for OSX or Docker for Windows](https://www.docker.com/products/docker)
* [IntelliJ Community Edition](https://www.jetbrains.com/idea/download/)
* [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
### Empezando
En IntelliJ, clonar el repositorio. Clic en `Check out from Version Control` > `Github`

Si esta es la primera vez usando Intellij con Github, ingresar a la cuenta de Github.

Clonar el repositorio [registration-docker](https://github.com/spara/registration-docker.git).

Clic en `Import project from external model`, seleccionar `Maven`. Clic `Next`

Seleccionar `Search for projects recursively`. Clic `Next`

Seleccionar el proyecto y clic en `Next`

Seleccionar el JDK y clic en `Next`

Clic en `Finish`

Clic en `Project View` para abrir el proyecto.

### Construyendo la aplicación
La aplicación es una aplicación Spring MVC básica que recibe datos del usuario de un formulario, almacena los datos en la base de datos, y realiza consultas.
La aplicación se construye usando Maven. Para construir la aplicación clic en el icono de la parte inferior izquierda de IntelliJ y seleccionar `Maven Projects`.

La ventana `Maven Projects` se abrirá al lado derecho. Las tareas de maven `clean` y `install` necesitan ser establecidas para construir la aplicación.
Para establecer la tarea `clean`, clic en `Lifecycle` para visualizar el árbol de tareas. Clic derecho en `clean` y seleccionar `Create 'UserSignup [clean]'...`

Clic `OK` en la ventana `Create Run/Debug Configuration`.

De manera similar configurar la tarea `install`. Clic en `install` en el árbol de Lifecycle. Seleccionar `Create 'UserSignup[install]'...`

Clic `OK` en la ventana `Create Run/Debug Configuration`.

Para construir la aplicación ejecutar `clean`

Luego ejecutar `install`

Cuando la aplicación se construya se visualizará un mensaje de éxito en la ventana de Log.

### Ejecutando la aplicación
Abrir un terminal e ir al directorio de la aplicación. Iniciar la aplicación con docker-compose
> docker-compose up
Docker construirá las imágenes para Apache Tomcat y MySQL e iniciará los contenedores. También, montará el directorio de la aplicación (`./app/target/UserSignup`) como volumen de datos en el host del sistema al directorio webapps Tomcat en el contenedor del servidor web.
Abrir una ventana en el explorador e ir a:
'localhost:8080'; debes ver la página de inicio de Tomcat

Cuando la imagen de Tomcat fue construida, los roles de los usuarios fueron configurados. Clic en el botón `Manager App` para visualizar las aplicaciones desplegadas. Cuando se solicite el usuario y la contraseña, ingresar `system` y `manager` respectivamente para entrar a la página de Tomcat Web Application Manager.

El posible usar la página Manager para `Start`, `Stop`, `Reload` o `Undeploy` aplicaciones web.
Para ir a la aplicación, clic en el link `/UserSignup`.

### Depurando la aplicación
En la aplicación, clic en `Signup` para crear un nuevo usuario. Completar el formulario de registro y clic en `Submit`

Clic `Yes` para confirmar.

Probar el inicio de sesión.

Oh no!

#### Configurar Depuración Remota
Tomcat soporta depuración remota usando Java Platform Debugger Architecture (JPDA). Debug Remoto fue habilitado cuando la imagen tomcat (registration-webserver) fue construida.
Para configurar la depuración remota en IntelliJ, clic en `Run` > `Edit Configuration ...`

Agregar una nueva configuración remota.

En la ventana `Run\Debug Configurations`, establecer el `Name` de la configuración y en `Settings` establecer el puerto '8000' el puerto de depuración de Tomcat JPDA por defecto. Clic en `OK` para guardar la configuración.

#### Buscando el Error
Dado que el problema es la contraseña, veamos como la contraseña se establece en la clase User. En la clase User, el setter para la contraseña es mezclado usando [rot13](https://en.wikipedia.org/wiki/ROT13) antes de ser almacenado en la base de datos.

Tratar registrando un nuevo usuario usando el depurador. En el menu clic en `Run` > `Debug...`

Elegir la configuración de depuración remota de Tomcat. La consola de depuración se motrará en la parte inferior de IntelliJ.

Establecer un punto de interrupción para la clase User donde el password es establecido.

Registrar un nuevo usuario con el usuario de 'Moby' y con 'm0by' como contraseña, clic `Submit`, clic `yes`

IntelliJ mostrará el código en el punto de interrupción y el valor de la contraseña en la ventana variables. Observar que el valor es `m0by`

Clic en `Resume Program` para permitir ejecutar el código o presionar `F8` para saltar el punto de interrupción.

A continuación, establecer el punto de interrupción en getPassword en la clase User para ver los valores retornados para la contraseña. También es posible cambiar el punto de interrupción a setPassword.

Tratar de acceder a la aplicación. Ver el valor de la contraseña en la ventana variables de Eclipse, observar que es `z0ol` el cual es `m0by` usando ROT13.

En esta aplicación MVC el UserController usa el método findByLogin en la clase UserServiceImpl la cual usa el método findByUsername para recuperar la información de la base de datos. A continuación, verificar que la contraseña del formulario conincide con la contraseña del usuario. Dado que la contraseña del formulario de inicio de sesión no es mezclada usando ROT13, este no coincide con la contraseña del usuario y no es posible acceder a la aplicación.
Para solucionar esto, aplicar ROT13 a la contraseña agregando
```
import com.docker.UserSignup.utit.Rot13
String passwd = Rot13.rot13(password);
```

Establecer un punto de interrupción en UserServiceImpl en el método findByLogin. Iniciar sesión otra vez y verificar los valores para el punto de interrupción. La variable 'passwd' es 'z0ol' la cual coincide con la contraseña para el usuario moby.

Continuar (`F8`) y debe acceder exitosamente.

================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/NetBeans-README.md
================================================
## In-container Java Development: NetBeans IDE
### Pre-requisites
* [Docker for OSX or Docker for Windows](https://www.docker.com/products/docker)
* [NetBeans IDE](https://netbeans.org/downloads/)
* [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
### Getting Started
Using your git client clone the repository.
```
git clone https://github.com/docker/labs
cd labs/developer-tools/java-debugging
```
Open NetBeans IDE, Click on `Open Project...`

Select `app` and click on `Open Project`.

### Building the application
The application is a basic Spring MVC application that receives user input from a form, writes the data to a database, and queries the database.
The application is built using Maven. To build the application click on `Run` > `Build Project`.

The results of the build will be displayed in the console.

### Running the application
Open a terminal and go to the application directory. Start the application with docker-compose
> docker-compose up
Docker will build the images for Apache Tomcat and MySQL and start the containers. It will also mount the application directory (`./app/target/UserSignup`) as a data volume on the host system to the Tomcat webapps directory in the web server container.
Open a browser window and go to:
'localhost:8080'; you should see the Tomcat home page

When the Tomcat image was built, the user roles were also configured. Click on the `Manager App` button to see the deployed applications. When prompted for username and password, enter `system` and `manager` respectively to log into the Tomcat Web Application Manager page.

You can use the Manager page to `Start`, `Stop`, `Reload` or `Undeploy` web applications.
To go to the application, Click on `/UserSignup` link.

### Debugging the Application
In the application, click on `Signup` to create a new user. Fill out the registration form and click `Submit`

Click `Yes` to confirm.

Test out the login.

Oh no!

#### Configure Remote Debugging
In the menu click on `Debug` > `Attach Debugger...`

Make sure that the port is set to 8000, click on `OK`.

#### Finding the Error
Since the problem is with the password, lets see how the password is set in the User class. In the User class, the setter for password is scrambled using [rot13](https://en.wikipedia.org/wiki/ROT13) before it is saved to the database.
Since we enabled remote debugging earlier, you should see the Daemon Threads for Tomcat in the `Debugging` window. Set a breakpoint for in the User class where the password is set.

Register a new user with the username of 'Moby' and with 'm0by' as the password, click `Submit`, click `yes`

NetBeans will display the code at the breakpoint and the value of password in the variables window. Note that the value is `m0by`

Click on `Continue` icon or press `F5` to let the code run.

Next, set a breakpoint on the getPassword in the User class to see the value returned for password. You can also toggle off the breakpoint for setPassword. Try to log into the application. Look at the value for password in the NetBeans variables window, note that it is `z0ol` which is `m0by` using ROT13.

In this MVC application the UserController uses the findByLogin method in the UserServiceImpl class which uses the findByUsername method to retrieve the information from the database. It then checks to see if the password from the form matches the user password. Since the password from the login form is not scrambled using ROT13, it does not match the user password and you cannot log into the application.
To fix this, apply ROT13 to the password by adding
```
import com.docker.UserSignup.utit.Rot13
String passwd = Rot13.rot13(password);
```

Set a breakpoint in UserServiceImpl on the findByLogin method. Press `F11` or click on `Run` > `Build Project` to update the deployed code. Log in again and look at the values for the breakpoint. The 'passwd' variable is `z0ol` which matches the password for the user moby.

Continue (`F5`) and you should successfully log in.

================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/NetBeans-README_es.md
================================================
## Desarrollo Java en Contenedor: NetBeans IDE
### Pre-requisitos
* [Docker for OSX or Docker for Windows](https://www.docker.com/products/docker)
* [NetBeans IDE](https://netbeans.org/downloads/)
* [Java Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
### Empezando
Usar el cliente git para clonar el repositorio.
```
git clone https://github.com/spara/registration-docker.git
```
Abrir NetBeans IDE, hacer clic en `Open Project...`

Seleccionar `app` y hacer clic en `Open Project`.

### Construyendo la aplicación
La aplicación es una aplicación Spring MVC básica que recibe datos del usuario de un formulario, almacena y consulta la informacion en la base de datos.
La aplicación se construye usando Maven. Para construir la aplicación hacer clic en `Run` > `Build Project`.

Los resultados del build serán mostrados en la consola.

### Ejecutando la aplicación
Abrir un terminal e ir al directorio de la aplicación. Iniciar la aplicación con docker-compose
> docker-compose up
Docker construirá las imágenes para Apache Tomcat y MySQL e iniciará los contenedores. También, montará el directorio de la aplicación (`./app/target/UserSignup`) como volumen de datos en el host del sistema al directorio webapps Tomcat en el contenedor del servidor web.
Abrir una ventana en el explorador e ir a:
'localhost:8080'; debes ver la página de inicio de Tomcat

Cuando la imagen de Tomcat fue construida, los roles de los usuarios fueron configurados. hacer clic en el botón `Manager App` para visualizar las aplicaciones desplegadas. Cuando se solicite por usuario y contraseña, ingresar `system` y `manager` respectivamente para entrar a la página de Tomcat Web Application Manager.

Puedes usar la página Manager para `Start`, `Stop`, `Reload` o `Undeploy` aplicaciones web.
Para ir a la aplicación, hacer clic en el link `/UserSignup`.

### Depurando la Aplicación
En la aplicación, hacer clic en `Signup` para crear un nuevo usuario. Completar el formulario de registro y hacer clic en `Submit`

Hacer clic en `Yes` para confirmar.

Probar el inicio de sesión.

Oh no!

#### Configurar Depuración Remota
En el menu hacer clic en `Debug` > `Attach Debugger...`

Asegurar que el puerto establecido es 8000, hacer clic en `OK`.

#### Buscando el Error
Dado que el problema es la contraseña, veamos como la contraseña se establece en la clase User. En la clase User, el setter para la contraseña es mezclado usando [rot13](https://en.wikipedia.org/wiki/ROT13) antes almacenarse en la base de datos.
Dado que habilitamos el depurador remoto previamente, debe ver los Daemon Threads para Tomcat en la ventana `Debugging`. Establecer un punto de interrupción para la clase User donde el password es establecido.

Registrar un nuevo usuario con el usuario de 'Moby' y con 'm0by' como contraseña, hacer clic en `Submit`, hacer clic en `yes`

NetBeans mostrará el código en el punto de interrupción y el valor de la contraseña en la ventana variables. Observar que el valor es `m0by`

Hacer clic en el icono `Continue` o presionar `F5` para permitir ejecutar el código.

A continuación, establecer el punto de interrupción en getPassword en la clase User para ver los valores retornados para la contraseña. También puede cambiar el punto de interrupción para setPassword. Tratar de acceder a la aplicación. Ver el valor de la contraseña en la ventana variables, observar que es `z0ol` el cual es `m0by` usando ROT13.

En esta aplicación MVC el UserController usa el método findByLogin en la clase UserServiceImpl la cual usa el método findByUsername para recuperar la información de la base de datos. A continuación, verifica que la contraseña del formulario conincide con la contraseña del usuario. Dado que la contraseña del formulario de inicio de sesión no es mezclada usando ROT13, este no coincide con la contraseña del usuario y no puedes acceder a la aplicación.
Para solucionar esto, aplicar ROT13 a la contraseña agregando
```
import com.docker.UserSignup.utit.Rot13
String passwd = Rot13.rot13(password);
```

Establecer un punto de interrupción en UserServiceImpl en el método findByLogin. Presionar `F11` o hacer clic en `Run` > `Build Project` para actualizar el código desplegado. Iniciar sesión otra vez y mirar los valores para el punto de interrupción. La variable 'passwd' es 'z0ol' la cual coincide con la contraseña para el usuario moby.

Continuar (`F5`) y debe acceder exitosamente.

================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/README.md
================================================
# Tutorial: Debugging Java Applications in Docker
Java developers can use Docker to build a development environment where they can run, test, and live debug code running within a container. Debugging a node.js application was demonstrated at DockerCon 2016 showing that development using containers can be performed on many platforms using other programming languages.
[](https://youtu.be/vE1iDPx6-Ok?list=PLkA60AVN3hh9gnrYwNO6zTb9U3i1Y9FMY&t=2088)
This tutorial includes Docker images and an application for Java development using containers. An examples for Eclipse, IntelliJ CE, and Netbeans are provided.
* [Eclipse](Eclipse-README.md)
* [IntelliJ](IntelliJ-README.md)
* [NetBeans](NetBeans-README.md)
Before starting the tutorial, please have [Docker](https://www.docker.com/products/overview) installed.
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/README_es.md
================================================
# Tutorial: Depurando Aplicaciones Java en Docker
Los programadores de Java pueden utilizar Docker para construir un ambiente de desarrollo donde puedan ejecutar, testear y depurar el código que está ejecutándose en un contenedor.
Durante la DockerCon 2016 se presentó cómo depurar una aplicación node.js, demostrando así que el desarrollo usando contenedores puede ser utilizado en muchas plataformas y con diferentes lenguajes de programación.
[](https://youtu.be/vE1iDPx6-Ok?list=PLkA60AVN3hh9gnrYwNO6zTb9U3i1Y9FMY&t=2088)
Este tutorial incluye imágenes Docker y una aplicación Java usando contenedores. Incluye además, ejemplos para Eclipse, IntelliJ CE y Netbeans.
* [Eclipse](Eclipse-README_es.md)
* [IntelliJ](IntelliJ-README_es.md)
* [NetBeans](NetBeans-README_es.md)
Antes de iniciar el tutorial, debe tener instalado [Docker](https://www.docker.com/products/overview) instalado.
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/.gitignore
================================================
/target/
UserSignup.war
UserSignup.iml
.DS_Store
.classpath
.project
/out/
/src/main/main.iml
.idea
.settings
.classpath
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/pom.xml
================================================
4.0.0com.dockerUserSignupwar0.0.1-SNAPSHOTUserSignup Maven Webapphttp://maven.apache.orgorg.springframeworkspring-webmvc5.2.21.RELEASEjavax.servletservlet-api2.5providedjavax.servletjstl1.2mysqlmysql-connector-java8.0.16org.hibernatehibernate-validator5.3.6.Finalorg.hibernatehibernate-entitymanager4.1.9.Finaljavax.transactionjta1.1org.springframeworkspring-jdbc3.2.0.RELEASEorg.springframeworkspring-orm3.2.0.RELEASEorg.springframework.dataspring-data-jpa~> 1.11.20org.springframeworkspring-aopUserSignup
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/controller/UserController.java
================================================
package com.docker.UserSignup.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.docker.UserSignup.model.User;
import com.docker.UserSignup.model.UserLogin;
import com.docker.UserSignup.service.UserService;
@Controller
@SessionAttributes("user")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(value="/signup", method=RequestMethod.GET)
public String signup(Model model) {
User user = new User();
model.addAttribute("user", user);
return "signup";
}
@RequestMapping(value="/signup", method=RequestMethod.POST)
public String signup(@Valid @ModelAttribute("user") User user, BindingResult result, Model model) {
if(result.hasErrors()) {
return "signup";
} else if(userService.findByUserName(user.getUserName())) {
model.addAttribute("message", "User Name exists. Try another user name");
return "signup";
} else {
userService.save(user);
model.addAttribute("message", "Saved user details");
return "redirect:login.html";
}
}
@RequestMapping(value="/login", method=RequestMethod.GET)
public String login(Model model) {
UserLogin userLogin = new UserLogin();
model.addAttribute("userLogin", userLogin);
return "login";
}
@RequestMapping(value="/login", method=RequestMethod.POST)
public String login(@Valid @ModelAttribute("userLogin") UserLogin userLogin, BindingResult result) {
if (result.hasErrors()) {
return "login";
} else {
boolean found = userService.findByLogin(userLogin.getUserName(), userLogin.getPassword());
if (found) {
return "success";
} else {
return "failure";
}
}
}
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/model/User.java
================================================
package com.docker.UserSignup.model;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;
import com.docker.UserSignup.util.Rot13;
@Entity
@Table(name="user")
public class User {
@Id
@GeneratedValue
private Long id;
@NotEmpty
@Size(min=4, max=20)
private String userName;
@NotEmpty
private String firstName;
@NotEmpty
private String lastName;
@NotEmpty
@Size(min=4, max=8)
private String password;
@NotEmpty
@Email
private String emailAddress;
@NotNull
@Past
@DateTimeFormat(pattern="MM/dd/yyyy")
private Date dateOfBirth;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = Rot13.rot13(password);
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/model/UserLogin.java
================================================
package com.docker.UserSignup.model;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotEmpty;
public class UserLogin {
@NotEmpty
@Size(min=4, max=20)
private String userName;
@NotEmpty
@Size(min=4, max=8)
private String password;
public String getPassword() {
return password;
}
public String getUserName() {
return userName;
}
public void setPassword(String password) {
this.password = password;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/repository/UserRepository.java
================================================
package com.docker.UserSignup.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.docker.UserSignup.model.User;
@Repository("userRepository")
public interface UserRepository extends JpaRepository {
@Query("select s from User s where s.userName = :userName")
User findByUserName(@Param("userName") String userName);
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/service/UserService.java
================================================
package com.docker.UserSignup.service;
import com.docker.UserSignup.model.User;
public interface UserService {
User save(User user);
boolean findByLogin(String userName, String password);
boolean findByUserName(String userName);
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/service/UserServiceImpl.java
================================================
package com.docker.UserSignup.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.docker.UserSignup.model.User;
import com.docker.UserSignup.repository.UserRepository;
@Service("userService")
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Transactional
public User save(User user) {
return userRepository.save(user);
}
public boolean findByLogin(String userName, String password) {
User usr = userRepository.findByUserName(userName);
if(usr != null && usr.getPassword().equals(password)) {
return true;
}
return false;
}
public boolean findByUserName(String userName) {
User usr = userRepository.findByUserName(userName);
if(usr != null) {
return true;
}
return false;
}
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/java/com/docker/UserSignup/util/Rot13.java
================================================
package com.docker.UserSignup.util;
public class Rot13 {
public static String rot13(String password) {
StringBuilder sb = new StringBuilder();
String passwd = password;
for (int i = 0; i < passwd.length(); i++) {
char c = passwd.charAt(i);
if (c >= 'a' && c <= 'm') c += 13;
else if (c >= 'A' && c <= 'M') c += 13;
else if (c >= 'n' && c <= 'z') c -= 13;
else if (c >= 'N' && c <= 'Z') c -= 13;
sb.append(c);
}
return sb.toString();
}
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/resources/META-INF/persistence.xml
================================================
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/resources/jpaContext.xml
================================================
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/resources/messages.properties
================================================
NotEmpty=Field cannot be blank
NotNull=Field cannot be blank
Email=Email Address not valid/well-formed
Past=Date of Birth must be in the past
Size={0} must be between {2} and {1} characters long
typeMismatch=Invalid format
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/webapp/WEB-INF/config/servletConfig.xml
================================================
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/webapp/WEB-INF/jsp/failure.jsp
================================================
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
Login Failure
'
, trigger: 'hover focus'
, title: ''
, delay: 0
, html: false
, container: false
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.'+ this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
var $tip = this.tip()
this.setContent()
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var $parent = this.$element.parent()
var orgPlacement = placement
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
this.$element.trigger('shown.bs.' + this.type)
}
}
Tooltip.prototype.applyPlacement = function(offset, placement) {
var replace
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft
$tip
.offset(offset)
.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
replace = true
offset.top = offset.top + height - actualHeight
}
if (/bottom|top/.test(placement)) {
var delta = 0
if (offset.left < 0) {
delta = offset.left * -2
offset.left = 0
$tip.offset(offset)
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
}
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
} else {
this.replaceArrow(actualHeight - height, actualHeight, 'top')
}
if (replace) $tip.offset(offset)
}
Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one($.support.transition.end, complete)
.emulateTransitionEnd(150) :
complete()
this.$element.trigger('hidden.bs.' + this.type)
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function () {
var el = this.$element[0]
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
width: el.offsetWidth
, height: el.offsetHeight
}, this.$element.offset())
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.tip = function () {
return this.$tip = this.$tip || $(this.options.template)
}
Tooltip.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
}
Tooltip.prototype.validate = function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
}
// TOOLTIP PLUGIN DEFINITION
// =========================
var old = $.fn.tooltip
$.fn.tooltip = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: popover.js v3.0.2
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right'
, trigger: 'click'
, content: ''
, template: '
'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find('.arrow')
}
Popover.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
// POPOVER PLUGIN DEFINITION
// =========================
var old = $.fn.popover
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.0.2
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
var href
var process = $.proxy(this.process, this)
this.$element = $(element).is('body') ? $(window) : $(element)
this.$body = $('body')
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .nav li > a'
this.offsets = $([])
this.targets = $([])
this.activeTarget = null
this.refresh()
this.process()
}
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.refresh = function () {
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
this.offsets = $([])
this.targets = $([])
var self = this
var $targets = this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#\w/.test(href) && $(href)
return ($href
&& $href.length
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
self.offsets.push(this[0])
self.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
var maxScroll = scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets.last()[0]) && this.activate(i)
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate( targets[i] )
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
$(this.selector)
.parents('.active')
.removeClass('active')
var selector = this.selector
+ '[data-target="' + target + '"],'
+ this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
var old = $.fn.scrollspy
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
$spy.scrollspy($spy.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.0.2
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
this.element = $(element)
}
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var previous = $ul.find('.active:last a')[0]
var e = $.Event('show.bs.tab', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.parent('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown.bs.tab'
, relatedTarget: previous
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu')) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active
.one($.support.transition.end, next)
.emulateTransitionEnd(150) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
}(jQuery);
/* ========================================================================
* Bootstrap: affix.js v3.0.2
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
+function ($) { "use strict";
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$window = $(window)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed =
this.unpin = null
this.checkPosition()
}
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var scrollHeight = $(document).height()
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top()
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return
if (this.unpin) this.$element.css('top', '')
this.affixed = affix
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
if (affix == 'bottom') {
this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
}
}
// AFFIX PLUGIN DEFINITION
// =======================
var old = $.fn.affix
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop
$spy.affix(data)
})
})
}(jQuery);
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/webapp/datepicker/css/datepicker.css
================================================
/*!
* Datepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker {
top: 0;
left: 0;
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
}
.datepicker:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.datepicker:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 7px;
}
.datepicker > div {
display: none;
}
.datepicker table {
width: 100%;
margin: 0;
}
.datepicker td,
.datepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker td.day:hover {
background: #eeeeee;
cursor: pointer;
}
.datepicker td.day.disabled {
color: #eeeeee;
}
.datepicker td.old,
.datepicker td.new {
color: #999999;
}
.datepicker td.active,
.datepicker td.active:hover {
color: #ffffff;
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
*background-color: #0044cc;
/* Darken IE7 buttons by default so they stand out more given they won't have borders */
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker td.active:hover,
.datepicker td.active:hover:hover,
.datepicker td.active:focus,
.datepicker td.active:hover:focus,
.datepicker td.active:active,
.datepicker td.active:hover:active,
.datepicker td.active.active,
.datepicker td.active:hover.active,
.datepicker td.active.disabled,
.datepicker td.active:hover.disabled,
.datepicker td.active[disabled],
.datepicker td.active:hover[disabled] {
color: #ffffff;
background-color: #0044cc;
*background-color: #003bb3;
}
.datepicker td.active:active,
.datepicker td.active:hover:active,
.datepicker td.active.active,
.datepicker td.active:hover.active {
background-color: #003399 \9;
}
.datepicker td span {
display: block;
width: 47px;
height: 54px;
line-height: 54px;
float: left;
margin: 2px;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker td span:hover {
background: #eeeeee;
}
.datepicker td span.active {
color: #ffffff;
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
*background-color: #0044cc;
/* Darken IE7 buttons by default so they stand out more given they won't have borders */
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker td span.active:hover,
.datepicker td span.active:focus,
.datepicker td span.active:active,
.datepicker td span.active.active,
.datepicker td span.active.disabled,
.datepicker td span.active[disabled] {
color: #ffffff;
background-color: #0044cc;
*background-color: #003bb3;
}
.datepicker td span.active:active,
.datepicker td span.active.active {
background-color: #003399 \9;
}
.datepicker td span.old {
color: #999999;
}
.datepicker th.switch {
width: 145px;
}
.datepicker th.next,
.datepicker th.prev {
font-size: 21px;
}
.datepicker thead tr:first-child th {
cursor: pointer;
}
.datepicker thead tr:first-child th:hover {
background: #eeeeee;
}
.input-append.date .add-on i,
.input-prepend.date .add-on i {
display: block;
cursor: pointer;
width: 16px;
height: 16px;
}
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/webapp/datepicker/js/bootstrap-datepicker.js
================================================
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ) {
// Picker object
var Datepicker = function(element, options){
this.element = $(element);
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
this.picker = $(DPGlobal.template)
.appendTo('body')
.on({
click: $.proxy(this.click, this)//,
//mousedown: $.proxy(this.mousedown, this)
});
this.isInput = this.element.is('input');
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
if (this.isInput) {
this.element.on({
focus: $.proxy(this.show, this),
//blur: $.proxy(this.hide, this),
keyup: $.proxy(this.update, this)
});
} else {
if (this.component){
this.component.on('click', $.proxy(this.show, this));
} else {
this.element.on('click', $.proxy(this.show, this));
}
}
this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0;
if (typeof this.minViewMode === 'string') {
switch (this.minViewMode) {
case 'months':
this.minViewMode = 1;
break;
case 'years':
this.minViewMode = 2;
break;
default:
this.minViewMode = 0;
break;
}
}
this.viewMode = options.viewMode||this.element.data('date-viewmode')||0;
if (typeof this.viewMode === 'string') {
switch (this.viewMode) {
case 'months':
this.viewMode = 1;
break;
case 'years':
this.viewMode = 2;
break;
default:
this.viewMode = 0;
break;
}
}
this.startViewMode = this.viewMode;
this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
this.onRender = options.onRender;
this.fillDow();
this.fillMonths();
this.update();
this.showMode();
};
Datepicker.prototype = {
constructor: Datepicker,
show: function(e) {
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
this.place();
$(window).on('resize', $.proxy(this.place, this));
if (e ) {
e.stopPropagation();
e.preventDefault();
}
if (!this.isInput) {
}
var that = this;
$(document).on('mousedown', function(ev){
if ($(ev.target).closest('.datepicker').length == 0) {
that.hide();
}
});
this.element.trigger({
type: 'show',
date: this.date
});
},
hide: function(){
this.picker.hide();
$(window).off('resize', this.place);
this.viewMode = this.startViewMode;
this.showMode();
if (!this.isInput) {
$(document).off('mousedown', this.hide);
}
//this.set();
this.element.trigger({
type: 'hide',
date: this.date
});
},
set: function() {
var formated = DPGlobal.formatDate(this.date, this.format);
if (!this.isInput) {
if (this.component){
this.element.find('input').prop('value', formated);
}
this.element.data('date', formated);
} else {
this.element.prop('value', formated);
}
},
setValue: function(newDate) {
if (typeof newDate === 'string') {
this.date = DPGlobal.parseDate(newDate, this.format);
} else {
this.date = new Date(newDate);
}
this.set();
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
this.fill();
},
place: function(){
var offset = this.component ? this.component.offset() : this.element.offset();
this.picker.css({
top: offset.top + this.height,
left: offset.left
});
},
update: function(newDate){
this.date = DPGlobal.parseDate(
typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
this.format
);
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
this.fill();
},
fillDow: function(){
var dowCnt = this.weekStart;
var html = '
';
while (dowCnt < this.weekStart + 7) {
html += '
'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'
';
}
html += '
';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function(){
var html = '';
var i = 0
while (i < 12) {
html += ''+DPGlobal.dates.monthsShort[i++]+'';
}
this.picker.find('.datepicker-months td').append(html);
},
fill: function() {
var d = new Date(this.viewDate),
year = d.getFullYear(),
month = d.getMonth(),
currentDate = this.date.valueOf();
this.picker.find('.datepicker-days th:eq(1)')
.text(DPGlobal.dates.months[month]+' '+year);
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
prevMonth.setDate(day);
prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
var nextMonth = new Date(prevMonth);
nextMonth.setDate(nextMonth.getDate() + 42);
nextMonth = nextMonth.valueOf();
var html = [];
var clsName,
prevY,
prevM;
while(prevMonth.valueOf() < nextMonth) {
if (prevMonth.getDay() === this.weekStart) {
html.push('
================================================
FILE: Docker/additional-ressources/developer-tools/java-debugging/app/src/main/webapp/jquery-1.8.3.js
================================================
/*!
* jQuery JavaScript Library v1.8.3
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
*/
(function( window, undefined ) {
var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
navigator = window.navigator,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// Save a reference to some core methods
core_push = Array.prototype.push,
core_slice = Array.prototype.slice,
core_indexOf = Array.prototype.indexOf,
core_toString = Object.prototype.toString,
core_hasOwn = Object.prototype.hasOwnProperty,
core_trim = String.prototype.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
// Used for detecting and trimming whitespace
core_rnotwhite = /\S/,
core_rspace = /\s+/,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over to avoid XSS via location.hash (#9521)
rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// The ready event handler and self cleanup method
DOMContentLoaded = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
} else if ( document.readyState === "complete" ) {
// we're here because readyState === "complete" in oldIE
// which is good enough for us to call the dom ready!
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
},
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context && context.nodeType ? context.ownerDocument || context : document );
// scripts is true for back-compat
selector = jQuery.parseHTML( match[1], doc, true );
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
this.attr.call( selector, context, true );
}
return jQuery.merge( this, selector );
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.8.3",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ),
"slice", core_slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ core_toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// scripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, scripts ) {
var parsed;
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
scripts = context;
context = 0;
}
context = context || document;
// Single tag
if ( (parsed = rsingleTag.exec( data )) ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
return jQuery.merge( [],
(parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
},
parseJSON: function( data ) {
if ( !data || typeof data !== "string") {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && core_rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var name,
i = 0,
length = obj.length,
isObj = length === undefined || jQuery.isFunction( obj );
if ( args ) {
if ( isObj ) {
for ( name in obj ) {
if ( callback.apply( obj[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( obj[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in obj ) {
if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var type,
ret = results || [];
if ( arr != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
type = jQuery.type( arr );
if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
core_push.call( ret, arr );
} else {
jQuery.merge( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key,
ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
var exec,
bulk = key == null,
i = 0,
length = elems.length;
// Sets many values
if ( key && typeof key === "object" ) {
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
}
chainable = 1;
// Sets one value
} else if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = pass === undefined && jQuery.isFunction( value );
if ( bulk ) {
// Bulk operations only iterate when executing function values
if ( exec ) {
exec = fn;
fn = function( elem, key, value ) {
return exec.call( jQuery( elem ), value );
};
// Otherwise they run against the entire set
} else {
fn.call( elems, value );
fn = null;
}
}
if ( fn ) {
for (; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
}
chainable = 1;
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready, 1 );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.split( core_rspace ), function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
return jQuery.inArray( fn, list ) > -1;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
function() {
var returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
} :
newDefer[ action ]
);
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ] = list.fire
deferred[ tuple[0] ] = list.fire;
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
fragment,
eventName,
i,
isSupported,
clickFn,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = "
a";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: ( document.compatMode === "CSS1Compat" ),
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", clickFn = function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent("onclick");
div.detachEvent( "onclick", clickFn );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
input.setAttribute( "checked", "checked" );
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: true,
change: true,
focusin: true
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Run tests that need a body at doc ready
jQuery(function() {
var container, div, tds, marginDiv,
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "
t
";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = document.createElement("div");
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
div.appendChild( marginDiv );
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
container.style.zoom = 1;
}
// Null elements to avoid leaks in IE
body.removeChild( container );
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
fragment.removeChild( div );
all = a = select = opt = input = fragment = div = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
deletedIds: [],
// Remove at next major release (1.9/2.0)
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery.removeData( elem, type + "queue", true );
jQuery.removeData( elem, key, true );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook, fixSpecified,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea|)$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var removes, className, elem, c, cl, i, l;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
removes = ( value || "" ).split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
className = (" " + elem.className + " ").replace( rclass, " " );
// loop over each item in the removal list
for ( c = 0, cl = removes.length; c < cl; c++ ) {
// Remove until there is nothing to remove,
while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
className = className.replace( " " + removes[ c ] + " " , " " );
}
}
elem.className = value ? jQuery.trim( className ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( core_rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
attrFn: {},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.split( core_rspace );
for ( ; i < attrNames.length; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.value = value + "" );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var t, tns, type, origType, namespaces, origCount,
j, events, special, eventType, handleObj,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, "events", true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
type = event.type || event,
namespaces = [];
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
for ( old = elem; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old === (elem.ownerDocument || document) ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = core_slice.call( arguments ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [];
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.disabled !== true || event.type !== "click" ) {
selMatch = {};
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
event.metaKey = !!event.metaKey;
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "_submit_attached" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "_submit_attached", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "_change_attached", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var cachedruns,
assertGetIdNotName,
Expr,
getText,
isXML,
contains,
compile,
sortOrder,
hasDuplicate,
outermostContext,
baseHasDuplicate = true,
strundefined = "undefined",
expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
Token = String,
document = window.document,
docElem = document.documentElement,
dirruns = 0,
done = 0,
pop = [].pop,
push = [].push,
slice = [].slice,
// Use a stripped-down indexOf if a native one is unavailable
indexOf = [].indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Augment a function for special use by Sizzle
markFunction = function( fn, value ) {
fn[ expando ] = value == null || value;
return fn;
},
createCache = function() {
var cache = {},
keys = [];
return markFunction(function( key, value ) {
// Only keep the most recent entries
if ( keys.push( key ) > Expr.cacheLength ) {
delete cache[ keys.shift() ];
}
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
return (cache[ key + " " ] = value);
}, cache );
},
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// Regex
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments not in parens/brackets,
// then attribute selectors and non-pseudos (denoted by :),
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
// For matchExpr.POS and matchExpr.needsContext
pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
rnot = /^:not/,
rsibling = /[\x20\t\r\n\f]*[+~]/,
rendsWithNot = /:not\($/,
rheader = /h\d/i,
rinputs = /input|select|textarea|button/i,
rbackslash = /\\(?!\\)/g,
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"POS": new RegExp( pos, "i" ),
"CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
},
// Support
// Used for testing something on an element
assert = function( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
},
// Check if getElementsByTagName("*") returns only elements
assertTagNameNoComments = assert(function( div ) {
div.appendChild( document.createComment("") );
return !div.getElementsByTagName("*").length;
}),
// Check if getAttribute returns normalized href attributes
assertHrefNotNormalized = assert(function( div ) {
div.innerHTML = "";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}),
// Check if attributes should be retrieved by attribute nodes
assertAttributes = assert(function( div ) {
div.innerHTML = "";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
}),
// Check if getElementsByClassName can be trusted
assertUsableClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
}),
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
assertUsableName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = document.getElementsByName &&
// buggy browsers will return fewer than the correct 2
document.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
document.getElementsByName( expando + 0 ).length;
assertGetIdNotName = !document.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// If slice is not available, provide a backup
try {
slice.call( docElem.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
for ( ; (elem = this[i]); i++ ) {
results.push( elem );
}
return results;
};
}
function Sizzle( selector, context, results, seed ) {
results = results || [];
context = context || document;
var match, elem, xml, m,
nodeType = context.nodeType;
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( nodeType !== 1 && nodeType !== 9 ) {
return [];
}
xml = isXML( context );
if ( !xml && !seed ) {
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
}
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
// Returns a function to use in pseudos for input types
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
// Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
} else {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
}
return ret;
};
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Element contains another
contains = Sizzle.contains = docElem.contains ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
} :
docElem.compareDocumentPosition ?
function( a, b ) {
return b && !!( a.compareDocumentPosition( b ) & 16 );
} :
function( a, b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
return false;
};
Sizzle.attr = function( elem, name ) {
var val,
xml = isXML( elem );
if ( !xml ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( xml || assertAttributes ) {
return elem.getAttribute( name );
}
val = elem.getAttributeNode( name );
return val ?
typeof elem[ name ] === "boolean" ?
elem[ name ] ? name : null :
val.specified ? val.value : null :
null;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
// IE6/7 return a modified href
attrHandle: assertHrefNotNormalized ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
},
find: {
"ID": assertGetIdNotName ?
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
} :
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
},
"TAG": assertTagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
var elem,
tmp = [],
i = 0;
for ( ; (elem = results[i]); i++ ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
},
"NAME": assertUsableName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
},
"CLASS": assertUsableClassName && function( className, context, xml ) {
if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
return context.getElementsByClassName( className );
}
}
},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( rbackslash, "" );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3 xn-component of xn+y argument ([+-]?\d*n|)
4 sign of xn-component
5 x of xn-component
6 sign of y-component
7 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1] === "nth" ) {
// nth-child requires argument
if ( !match[2] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
// other types prohibit arguments
} else if ( match[2] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var unquoted, excess;
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
if ( match[3] ) {
match[2] = match[3];
} else if ( (unquoted = match[4]) ) {
// Only check arguments that contain a pseudo
if ( rpseudo.test(unquoted) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
unquoted = unquoted.slice( 0, excess );
match[0] = match[0].slice( 0, excess );
}
match[2] = unquoted;
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"ID": assertGetIdNotName ?
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
return elem.getAttribute("id") === id;
};
} :
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === id;
};
},
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ expando ][ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem, context ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.substr( result.length - check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, argument, first, last ) {
if ( type === "nth" ) {
return function( elem ) {
var node, diff,
parent = elem.parentNode;
if ( first === 1 && last === 0 ) {
return true;
}
if ( parent ) {
diff = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
diff++;
if ( elem === node ) {
break;
}
}
}
}
// Incorporate the offset (or cast to NaN), then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
};
}
return function( elem ) {
var node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
var nodeType;
elem = elem.firstChild;
while ( elem ) {
if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
return false;
}
elem = elem.nextSibling;
}
return true;
},
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"text": function( elem ) {
var type, attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
(type = elem.type) === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
},
// Input types
"radio": createInputPseudo("radio"),
"checkbox": createInputPseudo("checkbox"),
"file": createInputPseudo("file"),
"password": createInputPseudo("password"),
"image": createInputPseudo("image"),
"submit": createButtonPseudo("submit"),
"reset": createButtonPseudo("reset"),
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"focus": function( elem ) {
var doc = elem.ownerDocument;
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
"active": function( elem ) {
return elem === elem.ownerDocument.activeElement;
},
// Positional types
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 0; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 1; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
function siblingCheck( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
}
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
a.compareDocumentPosition :
a.compareDocumentPosition(b) & 4
) ? -1 : 1;
} :
function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
[0, 0].sort( sortOrder );
baseHasDuplicate = !hasDuplicate;
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ expando ][ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
// Cast descendant combinators to space
matched.type = match[0].replace( rtrim, " " );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
matched.type = type;
matched.matches = match;
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && combinator.dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( !xml ) {
var cache,
dirkey = dirruns + " " + doneName + " ",
cachedkey = dirkey + cachedruns;
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( (cache = elem[ expando ]) === cachedkey ) {
return elem.sizset;
} else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
if ( elem.sizset ) {
return elem;
}
} else {
elem[ expando ] = cachedkey;
if ( matcher( elem, context, xml ) ) {
elem.sizset = true;
return elem;
}
elem.sizset = false;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( matcher( elem, context, xml ) ) {
return elem;
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && tokens.join("")
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Nested matchers should use non-integer dirruns
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = superMatcher.el;
}
// Add elements passing elementMatchers directly to results
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++superMatcher.el;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
for ( j = 0; (matcher = setMatchers[j]); j++ ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
superMatcher.el = 0;
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ expando ][ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed, xml ) {
var i, tokens, token, type, find,
match = tokenize( selector ),
j = match.length;
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && !xml &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().length );
}
// Fetch a seed set for right-to-left matching
for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( rbackslash, "" ),
rsibling.test( tokens[0].type ) && context.parentNode || context,
xml
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && tokens.join("");
if ( !selector ) {
push.apply( results, slice.call( seed, 0 ) );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
xml,
results,
rsibling.test( selector )
);
return results;
}
if ( document.querySelectorAll ) {
(function() {
var disconnectedMatch,
oldSelect = select,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ],
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
// A support test would require too much code (would include document ready)
// just skip matchesSelector for :active
rbuggyMatches = [ ":active" ],
matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector;
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here (do not put tests after this one)
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE9 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "";
if ( div.querySelectorAll("[test^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here (do not put tests after this one)
div.innerHTML = "";
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push(":enabled", ":disabled");
}
});
// rbuggyQSA always contains :focus, so no need for a length check
rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
select = function( selector, context, results, seed, xml ) {
// Only use querySelectorAll when not filtering,
// when this is not xml,
// and when no QSA bugs apply
if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
var groups, i,
old = true,
nid = expando,
newContext = context,
newSelector = context.nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + groups[i].join("");
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
return oldSelect( selector, context, results, seed, xml );
};
if ( matches ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
try {
matches.call( div, "[test!='']:sizzle" );
rbuggyMatches.push( "!=", pseudos );
} catch ( e ) {}
});
// rbuggyMatches always contains :active and :focus, so no need for a length check
rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
Sizzle.matchesSelector = function( elem, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyMatches always contains :active, so no need for an existence check
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
}
})();
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Back-compat
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i, l, length, n, r, ret,
self = this;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
ret = this.pushStack( "", "find", selector );
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /]", "i"),
rcheckableType = /^(?:checkbox|radio)$/,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*\s*$/g,
wrapMap = {
option: [ 1, "" ],
legend: [ 1, "" ],
thead: [ 1, "
", "
" ],
tr: [ 2, "
", "
" ],
td: [ 3, "
", "
" ],
col: [ 2, "
", "
" ],
area: [ 1, "" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "X
", "
" ];
}
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
}
},
after: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1>$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName( "*" ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
if ( !isDisconnected( this[0] ) ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
}
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// Flatten any nested arrays
args = [].concat.apply( [], args );
var results, first, fragment, iNoClone,
i = 0,
value = args[0],
scripts = [],
l = this.length;
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call( this, i, table ? self.html() : undefined );
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
results = jQuery.buildFragment( args, this, scripts );
fragment = results.fragment;
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
// Fragments from the fragment cache must always be cloned and never used in place.
for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
i === iNoClone ?
fragment :
jQuery.clone( fragment, true, true )
);
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
if ( scripts.length ) {
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
if ( jQuery.ajax ) {
jQuery.ajax({
url: elem.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.error("no ajax");
}
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
});
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
if ( nodeName === "object" ) {
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, context, scripts ) {
var fragment, cacheable, cachehit,
first = args[ 0 ];
// Set context from what may come in as undefined or a jQuery collection or a node
// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put