Skip to content

Commit a91bbbb

Browse files
committed
Import more blog posts
1 parent 7251a4c commit a91bbbb

15 files changed

+1111
-21
lines changed

archive.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,41 @@ <h4>April 2013</h4>
8989
<ul>
9090

9191
<li>03 - <a href="blog/2013/test-driven-troubleshooting.html">Test-driven Troubleshooting</a></li>
92+
</ul>
93+
<h4>August 2012</h4>
94+
<ul>
95+
96+
<li>12 - <a href="blog/2012/improving-cmd-exe.html">Improving cmd.exe</a></li>
9297
</ul>
9398
<h4>February 2012</h4>
9499
<ul>
95100

96101
<li>15 - <a href="blog/2012/oracle-xquery-bug.html">Oracle XQuery Bug?</a></li>
102+
</ul>
103+
<h4>December 2010</h4>
104+
<ul>
105+
106+
<li>07 - <a href="blog/2010/unhelpful-jsf-error.html">Unhelpful JSF Error</a></li>
97107
</ul>
98108
<h4>June 2010</h4>
99109
<ul>
100110

101111
<li>18 - <a href="blog/2010/dns-aliasing.html">DNS aliasing: panacea?</a></li>
112+
</ul>
113+
<h4>January 2009</h4>
114+
<ul>
115+
116+
<li>22 - <a href="blog/2009/brutalities.html">Brutalities</a></li>
117+
</ul>
118+
<h4>November 2008</h4>
119+
<ul>
120+
121+
<li>10 - <a href="blog/2008/maven-jaxb-and-workarounds.html">Maven, JAXB, and Workarounds</a></li>
122+
</ul>
123+
<h4>October 2008</h4>
124+
<ul>
125+
126+
<li>23 - <a href="blog/2008/xml.html">XML</a></li>
102127
</ul>
103128

104129
</div>
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>Maven, JAXB, and Workarounds</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="description" content="">
8+
<meta name="author" content="">
9+
<meta name="keywords" content="">
10+
<meta name="generator" content="JBake">
11+
12+
<!-- Le styles -->
13+
<link href="../../css/bootstrap.min-3.3.7.css" rel="stylesheet">
14+
<link href="../../css/asciidoctor.css" rel="stylesheet">
15+
<link href="../../css/base.css" rel="stylesheet">
16+
<link href="../../css/prettify.css" rel="stylesheet">
17+
18+
<script>
19+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
20+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
21+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
22+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
23+
24+
ga('create', 'UA-99754303-1', 'auto');
25+
ga('send', 'pageview');
26+
</script>
27+
28+
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
29+
<!--[if lt IE 9]>
30+
<script src="../../js/html5shiv.min.js"></script>
31+
<![endif]-->
32+
33+
<!-- Fav and touch icons -->
34+
<!--<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
35+
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
36+
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
37+
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">-->
38+
<link rel="shortcut icon" href="../../favicon.png">
39+
</head>
40+
<body onload="prettyPrint()">
41+
<div id="wrap">
42+
43+
<!-- Fixed navbar -->
44+
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
45+
<div class="container">
46+
<div class="navbar-header">
47+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
48+
<span class="sr-only">Toggle navigation</span>
49+
<span class="icon-bar"></span>
50+
<span class="icon-bar"></span>
51+
<span class="icon-bar"></span>
52+
</button>
53+
<a class="navbar-brand" href="../../">Heroicode</a>
54+
</div>
55+
<div class="navbar-collapse collapse">
56+
<ul class="nav navbar-nav">
57+
<li><a href="../../index.html">Home</a></li>
58+
<li><a href="../../about.html">About</a></li>
59+
<li><a href="../../resume.html">Résumé</a></li>
60+
<li><a href="../../feed.xml">Subscribe</a></li>
61+
</ul>
62+
</div><!--/.nav-collapse -->
63+
</div>
64+
</div>
65+
<div class="container">
66+
<div class="page-header">
67+
<h1>Maven, JAXB, and Workarounds</h1>
68+
</div>
69+
70+
<p><em>10 November 2008</em></p>
71+
72+
<p><p>We’re using Maven 2 at work to build our projects now. One of the projects uses JAXB to manage some XML documents. Well, the JAXB standard doesn’t say anything about how namespaces are handled when marshalling to XML, which means I can’t write XSLT against our output (FAIL). Sun’s JAXB implementation has a way to control namespace output, but it’s non-standard. Even worse, it changed between Java 5.0 and 6.0 (package rename), so code written against 5.0 will fail when running in a newer JVM.</p>
73+
<p>I’m <a target="_blank"
74+
href="http://pragmaticintegration.blogspot.com/2007/11/moving-jaxb-20-applications-built-by.html"
75+
>not the only one</a> who has had this problem, but I think my solution is different than any I’ve seen. It took me a long time to get Maven to cooperate, but I finally got it working. I believe I found a bug in Maven, but I haven’t looked at the source yet to verify it. Maven documentation is extremely lacking when it comes to explaining what’s really going on. Sadly, it’s the best thing out there; the only good thing I can say is Maven 2 is better than the original.</p>
76+
<p>Here is the Java code and Maven POM excerpts necessary to explain my solution:</p>
77+
<pre><code class="java">import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
78+
class PrefixMapper_JDK5 extends NamespacePrefixMapper {
79+
@Override
80+
public String getPreferredPrefix(String namespaceUri, String suggestion,
81+
boolean requirePrefix) {
82+
return suggestion;
83+
}
84+
}
85+
86+
//JDK 6 added &quot;internal&quot; to the package naming
87+
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
88+
class PrefixMapper_JDK6 extends NamespacePrefixMapper {
89+
@Override
90+
public String getPreferredPrefix(String namespaceUri, String suggestion,
91+
boolean requirePrefix) {
92+
return suggestion;
93+
}
94+
}
95+
96+
public Object getNamespacePrefixMapper() {
97+
Object r = null;
98+
//the mapper classes should be compiled separately before this method
99+
//is compiled so they match the proper JDK (-source and -target flags)
100+
Class[] mapperList = {
101+
//first one in list gets priority...
102+
PrefixMapper_JDK6.class, PrefixMapper_JDK5.class
103+
};
104+
try { //there is a better way to implement this... you can figure it out
105+
r = mapperList[0].getClass().newInstance();
106+
} catch (Exception e) {
107+
try {
108+
r = mapperList[1].getClass().newInstance();
109+
} catch (Exception ex) {}
110+
}
111+
return r; //null if neither class could be loaded
112+
}
113+
</code></pre>
114+
<pre><code class="xml">&lt;plugin&gt;
115+
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
116+
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
117+
&lt;configuration&gt;
118+
&lt;source&gt;1.6&lt;/source&gt;
119+
&lt;target&gt;1.6&lt;/target&gt;
120+
&lt;excludes&gt;
121+
&lt;!-- Maven is buggy here and will not remove the first
122+
exclude line given, so the first one needs to be
123+
bogus. --&gt;
124+
&lt;exclude&gt;==MavenBugWorkaround==&lt;/exclude&gt;
125+
&lt;exclude&gt;**/PrefixMapper_JDK5.java&lt;/exclude&gt;
126+
&lt;/excludes&gt;
127+
&lt;/configuration&gt;
128+
&lt;executions&gt;
129+
&lt;execution&gt;
130+
&lt;goals&gt;
131+
&lt;goal&gt;compile&lt;/goal&gt;
132+
&lt;/goals&gt;
133+
&lt;phase&gt;compile&lt;/phase&gt;
134+
&lt;configuration&gt;
135+
&lt;source&gt;1.5&lt;/source&gt;
136+
&lt;target&gt;1.5&lt;/target&gt;
137+
&lt;!-- clears inherited exclude list
138+
(except for 1st element) --&gt;
139+
&lt;excludes/&gt;
140+
&lt;!-- only uncompiled files will be looked at --&gt;
141+
&lt;includes&gt;
142+
&lt;include&gt;**/*.java&lt;/include&gt;
143+
&lt;/includes&gt;
144+
&lt;/configuration&gt;
145+
&lt;/execution&gt;
146+
&lt;/executions&gt;
147+
&lt;/plugin&gt;
148+
</code></pre></p>
149+
150+
<hr />
151+
152+
</div>
153+
<div id="push"></div>
154+
</div>
155+
156+
<div id="footer">
157+
<div class="container">
158+
<p class="muted credit">&copy; 2017 | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.3.7</a> | Baked with <a href="http://jbake.org">JBake v2.5.1</a></p>
159+
</div>
160+
</div>
161+
162+
<!-- Le javascript
163+
================================================== -->
164+
<!-- Placed at the end of the document so the pages load faster -->
165+
<script src="../../js/jquery-1.11.1.min.js"></script>
166+
<script src="../../js/bootstrap.min-3.3.7.js"></script>
167+
<script src="../../js/prettify.js"></script>
168+
169+
</body>
170+
</html>

blog/2008/xml.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>XML</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="description" content="">
8+
<meta name="author" content="">
9+
<meta name="keywords" content="">
10+
<meta name="generator" content="JBake">
11+
12+
<!-- Le styles -->
13+
<link href="../../css/bootstrap.min-3.3.7.css" rel="stylesheet">
14+
<link href="../../css/asciidoctor.css" rel="stylesheet">
15+
<link href="../../css/base.css" rel="stylesheet">
16+
<link href="../../css/prettify.css" rel="stylesheet">
17+
18+
<script>
19+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
20+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
21+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
22+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
23+
24+
ga('create', 'UA-99754303-1', 'auto');
25+
ga('send', 'pageview');
26+
</script>
27+
28+
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
29+
<!--[if lt IE 9]>
30+
<script src="../../js/html5shiv.min.js"></script>
31+
<![endif]-->
32+
33+
<!-- Fav and touch icons -->
34+
<!--<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
35+
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
36+
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
37+
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">-->
38+
<link rel="shortcut icon" href="../../favicon.png">
39+
</head>
40+
<body onload="prettyPrint()">
41+
<div id="wrap">
42+
43+
<!-- Fixed navbar -->
44+
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
45+
<div class="container">
46+
<div class="navbar-header">
47+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
48+
<span class="sr-only">Toggle navigation</span>
49+
<span class="icon-bar"></span>
50+
<span class="icon-bar"></span>
51+
<span class="icon-bar"></span>
52+
</button>
53+
<a class="navbar-brand" href="../../">Heroicode</a>
54+
</div>
55+
<div class="navbar-collapse collapse">
56+
<ul class="nav navbar-nav">
57+
<li><a href="../../index.html">Home</a></li>
58+
<li><a href="../../about.html">About</a></li>
59+
<li><a href="../../resume.html">Résumé</a></li>
60+
<li><a href="../../feed.xml">Subscribe</a></li>
61+
</ul>
62+
</div><!--/.nav-collapse -->
63+
</div>
64+
</div>
65+
<div class="container">
66+
<div class="page-header">
67+
<h1>XML</h1>
68+
</div>
69+
70+
<p><em>23 October 2008</em></p>
71+
72+
<p><p>I vote for making XML abuse a crime. People treat it like it’s AI or something – use it and your program magically “understands” things.</p>
73+
<p>The application I’m calling has an XML format; our company has an XML format – I get to convert back and forth between the two. Our format is infinitely recursive… The business rules engine is XML-based. There are XML config files, schemas, wsdl files, build scripts, repository meta-data, entity mapping specifications, XSLT…</p>
74+
<p>Someone please bring an end to all this misery. Stop using a document format for everything that’s not a document!</p></p>
75+
76+
<hr />
77+
78+
</div>
79+
<div id="push"></div>
80+
</div>
81+
82+
<div id="footer">
83+
<div class="container">
84+
<p class="muted credit">&copy; 2017 | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.3.7</a> | Baked with <a href="http://jbake.org">JBake v2.5.1</a></p>
85+
</div>
86+
</div>
87+
88+
<!-- Le javascript
89+
================================================== -->
90+
<!-- Placed at the end of the document so the pages load faster -->
91+
<script src="../../js/jquery-1.11.1.min.js"></script>
92+
<script src="../../js/bootstrap.min-3.3.7.js"></script>
93+
<script src="../../js/prettify.js"></script>
94+
95+
</body>
96+
</html>

0 commit comments

Comments
 (0)