Skip to content

Instantly share code, notes, and snippets.

View IngmarBoddington's full-sized avatar

Ingmar Boddington IngmarBoddington

View GitHub Profile
@IngmarBoddington
IngmarBoddington / java
Last active January 24, 2016 19:51
Notes for Java OCA Exam | Full Java 7 APi docs: http://docs.oracle.com/javase/7/docs/api/ | Tools: http://docs.oracle.com/javase/7/docs/technotes/tools/ | Get .jars here: https://oss.sonatype.org | Notation: <value>, [<optional value>]
Packages
========
- Encapsulate classes within a namespace
- Generally these take a reverse domain name format ending with class name (when fully qualified), e.g. com.company.classname
- Should map to directory structure and use reverse domain, e.g. root/com/company/classname
- java.lang is imported by default
- lowercase (though class name can have caps), underscores should be used for spaces
- java.* (core) and javax.* (standard extensions) are reserved
- It is better to be explicit when importing, rather than being implicit (using wildcards)
- 209 packages in Java SE 7 API
@IngmarBoddington
IngmarBoddington / samhain
Last active October 11, 2017 20:55
Samhain commands
Check for violations:
samhain -t check --foreground -p err -s none -l none -m none
Clear violations:
samhain -t update -l none --foreground
@IngmarBoddington
IngmarBoddington / maven
Last active October 12, 2017 10:57
General Maven Use
mvn [<plugin>:]<goal>
- General use
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
- Example project create
mvn test
- Run unit tests specified by pom.xml (need unit dependancies in pom)
mvn sonar:sonar
@IngmarBoddington
IngmarBoddington / settings.xml
Last active November 18, 2019 18:03
Maven settings file (example with MySQL setup for Sonar)
<settings>
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>
jdbc:mysql://localhost:3306/sonar
@IngmarBoddington
IngmarBoddington / pom.xml
Created July 6, 2014 21:10
Apache Maven pom for (basic + junit + sonar requirements)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>NAME</name>
@IngmarBoddington
IngmarBoddington / unitTesting
Last active August 29, 2015 14:02
Basic PHPUnit Notes
A few gard won lessons!
1. You cannot set expectations on a non-mocked method
2. Don't use multiple mocks of the same class and then inject these into another mock
3. When using at, this applies at an object level, not method
4. When using at, any mocked methods will be expected in the ordering
phpunit
- Standard use (consumes phpunit.xml.dist)
@IngmarBoddington
IngmarBoddington / companyNumbers
Created June 11, 2014 11:41
UK Company Numbers
Company Registration Number Formats English and Welsh companies have registration numbers that consist of 8 digits. Companies registered in Scotland and Northern Ireland and those registered by the Financial Services Authority have a 1 or 2 character alphabetic prefix. The following are possible values for the prefix. Value Description AC Assurance Company England and Wales FC Foreign Company England and Wales GE European Economic Interest Grouping (EEIG) England and Wales GN EEIG Northern Ireland GS EEIG Scotland IC Investment Company with Variable Capital (ICVC) England and Wales IP Industrial and Provident England and Wales LP Limited Partnership England and Wales NA Assurance Company Northern Ireland NF Foreign Company Northern Ireland NI Northern Ireland Company NL Limited Partnership Northern Ireland (This prefix is not applicable to CT and should not be used) NO Other Northern Ireland NP Industrial and Provident Northern Ireland NR Royal Charter Northern Ireland NZ Not Companies Act Northern Irelan
@IngmarBoddington
IngmarBoddington / LaunchDaemons
Created June 5, 2014 11:50
Example launch Deamon config for OSX (should live in /Library/LaunchDaemons) (Example is for local Sonar install)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sonar.services</string>
<key>ProgramArguments</key>
<array>
<string>/Users/iboddington/apps/sonar-3.6/bin/macosx-universal-64/sonar.sh</string>
<string>start</string>
@IngmarBoddington
IngmarBoddington / pearPeclEtc
Created June 4, 2014 15:11
pear useful commands + setup for pear / PHPCS / PHPUnit / PHPMD / PHPDocumentor /
pear clear-cache
pear update-channels
- Housekeeping
pear config-get php_dir
- Displays directory which should be included in php include_path for correct working of packages
pear list -a
- List installed packages by channel
@IngmarBoddington
IngmarBoddington / template_class.php
Created June 1, 2014 15:56
Verbose - toString and get / set enforcement
<?php
class templateClass {
private $variable = 'pretest'; //Test variable
function __contruct() {
//Init
}