Skip to content

Instantly share code, notes, and snippets.

View michaelrice's full-sized avatar

Michael Rice michaelrice

View GitHub Profile
@Test
public void test_GetAllFields_Returns_All_Fields_With_AbstractClass() throws Exception {
abstract class MySuperClass {
public String baz;
public void myBaz() {}
}
class MyClass extends MySuperClass {
public String foo;
public int[] bar;
@michaelrice
michaelrice / gist:1f291d58a1d0328983ef
Created February 8, 2015 16:33
assertion failure
public class ReflectUtil {
public static Field[] getAllFields(Class<?> c) {
List<Field> listOfFields = new ArrayList<Field>();
getAllFields(c, listOfFields);
Field[] arrayOfFields = new Field[listOfFields.size()];
listOfFields.toArray(arrayOfFields);
return arrayOfFields;
}
package com.test
import grails.test.ControllerUnitTestCase
import grails.test.mixin.*
import org.junit.*
/**
* See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
*/
src/FbTk/FontImp.hh:28:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
^
1 error generated.
make[2]: *** [src/FbTk/libFbTk_a-XmbFontImp.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
@michaelrice
michaelrice / issue-190.yaml
Created November 21, 2014 01:44
VCR recording of issue 190
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [python-requests/2.4.3 CPython/2.7.8 Darwin/13.4.0]
method: GET
uri: https://10.12.254.137:443//sdk/vimServiceVersions.xml
@michaelrice
michaelrice / vcd_should_fail.yaml
Created November 4, 2014 04:33
usage meter strangeness adding a vcd
interactions:
- request:
body: <vcServer xmlns="http://www.vmware.com/UM"><hostname>10.12.254.111</hostname><username>toor</username><password>bad
password</password></vcServer>
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['146']
Content-Type: [text/xml]
Groovy Shell (1.8.6, JVM: 1.7.0_67)
Type 'help' or '\h' for help.
--------------------------------------------------------------------------------------------------------------------------------------------
groovy:000> foo.each{}
ERROR groovy.lang.MissingPropertyException:
No such property: foo for class: groovysh_evaluate
at groovysh_evaluate.run (groovysh_evaluate:2)
...
groovy:000>
from __future__ import unicode_literals
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import SubElement
from xml.etree.ElementTree import tostring
def _build_customer_payload(customer):
"""
<customer xmlns="http://www.vmware.com/UM">
List buildRDMInformation(Inventory inventory) {
// To store the RDM information
List rdmInfos = []
// For each VM in the inventory
inventory.vms.each { vm ->
// Get the host
Host h = (Host) vm.host
@michaelrice
michaelrice / gist:546b38b06e51b35de9a6
Created October 14, 2014 18:47
pyVmomi licensableResource
>>> children = content.rootFolder.childEntity
>>> hosts = children[0].hostFolder.childEntity
>>> hosts[0].host[0].licensableResource
(vim.LicenseManager.LicensableResourceInfo) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
resource = (vmodl.KeyAnyValue) [
(vmodl.KeyAnyValue) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],