-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
837 lines (474 loc) · 33.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Techfee</title>
<meta name="author" content="squallssck">
<meta name="description" content="
">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://squallssck.github.com/">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="/javascripts/ender.js"></script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<link href="/atom.xml" rel="alternate" title="Techfee" type="application/atom+xml">
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">Techfee</a></h1>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:squallssck.github.com" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/03/13/about-how-to-design-a-worker-queue-style-node-js-application-server/">About How to Design a Worker Queue Style Node Js Application Server</a></h1>
<p class="meta">
<time datetime="2013-03-13T01:58:00-04:00" pubdate data-updated="true">Mar 13<span>th</span>, 2013</time>
| <a href="/blog/2013/03/13/about-how-to-design-a-worker-queue-style-node-js-application-server/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content">
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/03/07/about-how-to-make-phantomjs-support-google-web-fonts/">About How to Make Phantomjs Render Google Embeded Web Fonts Correctly</a></h1>
<p class="meta">
<time datetime="2013-03-07T14:57:00-05:00" pubdate data-updated="true">Mar 7<span>th</span>, 2013</time>
| <a href="/blog/2013/03/07/about-how-to-make-phantomjs-support-google-web-fonts/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><blockquote><p>Currently, before 1.8.1 version, phantomjs doesn’t support WOFF files, a fix is to use
https://github.com/Vitallium ‘s commit which has fixed WOFF file support issue. But you have to compile it from source, it takes a long time if your computer is not powerful enough. On my Quad-Core i7 laptop, it uses 10-15 minutes. On my EC2 dul-core middle instance, it compiles forever…</p></blockquote>
<p><em>The Web Open Font Format (WOFF) is a font format for use in web pages</em></p>
<p>To do:</p>
<blockquote><p>1) Checkout PhantomJS 1.X version as described in the official instruction: http://phantomjs.org/build.html</p></blockquote>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>// For Ubuntu Linux (tested on a barebone install of Ubuntu 10.04 Lucid Lynx and Ubuntu 11.04 Natty Narwhal):
</span><span class='line'>
</span><span class='line'>sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
</span><span class='line'>git clone git://github.com/ariya/phantomjs.git
</span><span class='line'>cd phantomjs
</span><span class='line'>git checkout 1.8
</span><span class='line'>//./build.sh
</span><span class='line'>
</span><span class='line'>// On Mac OS, Install Xcode and the necessary SDK for development (gcc, various tools, libraries, etc).
</span><span class='line'>
</span><span class='line'>git clone git://github.com/ariya/phantomjs.git
</span><span class='line'>cd phantomjs
</span><span class='line'>git checkout 1.8
</span><span class='line'>//./build.sh
</span></code></pre></td></tr></table></div></figure>
<p><strong> Note that by don’t ./build.sh now, cause it’s the master branch of the phantomjs, so, after checkout, don’t build. </strong></p>
<blockquote><p>2) Add the remote repo which contains the needed branch:</p></blockquote>
</div>
<footer>
<a rel="full-article" href="/blog/2013/03/07/about-how-to-make-phantomjs-support-google-web-fonts/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/27/about-how-to-embed-image-into-one-single-html/">About How to Embed Image Into One Single Html</a></h1>
<p class="meta">
<time datetime="2013-02-27T13:48:00-05:00" pubdate data-updated="true">Feb 27<span>th</span>, 2013</time>
| <a href="/blog/2013/02/27/about-how-to-embed-image-into-one-single-html/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
<span class='line-number'>55</span>
<span class='line-number'>56</span>
<span class='line-number'>57</span>
<span class='line-number'>58</span>
<span class='line-number'>59</span>
<span class='line-number'>60</span>
</pre></td><td class='code'><pre><code class='java'><span class='line'><span class="kd">private</span> <span class="kd">static</span> <span class="n">String</span> <span class="nf">embed</span><span class="o">(</span><span class="n">File</span> <span class="n">htmlFile</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'> <span class="n">String</span> <span class="n">final_return</span> <span class="o">=</span> <span class="s">"error"</span><span class="o">;</span>
</span><span class='line'>
</span><span class='line'> <span class="k">try</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'> <span class="n">BufferedReader</span> <span class="n">br</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferedReader</span><span class="o">(</span><span class="k">new</span> <span class="n">FileReader</span><span class="o">(</span><span class="n">htmlFile</span><span class="o">));</span>
</span><span class='line'>
</span><span class='line'> <span class="n">StringBuilder</span> <span class="n">sb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StringBuilder</span><span class="o">();</span>
</span><span class='line'>
</span><span class='line'> <span class="n">String</span> <span class="n">line</span> <span class="o">=</span> <span class="s">""</span><span class="o">;</span>
</span><span class='line'>
</span><span class='line'> <span class="k">while</span> <span class="o">((</span><span class="n">line</span> <span class="o">=</span> <span class="n">br</span><span class="o">.</span><span class="na">readLine</span><span class="o">())</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'> <span class="n">sb</span><span class="o">.</span><span class="na">append</span><span class="o">(</span><span class="n">line</span><span class="o">);</span>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'>
</span><span class='line'> <span class="n">br</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
</span><span class='line'>
</span><span class='line'> <span class="n">String</span> <span class="n">htmlContent</span> <span class="o">=</span> <span class="n">sb</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span>
</span><span class='line'>
</span><span class='line'> <span class="n">org</span><span class="o">.</span><span class="na">jsoup</span><span class="o">.</span><span class="na">nodes</span><span class="o">.</span><span class="na">Document</span> <span class="n">doc</span> <span class="o">=</span> <span class="n">Jsoup</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="n">htmlContent</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="n">Elements</span> <span class="n">images</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="na">getElementsByTag</span><span class="o">(</span><span class="s">"img"</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="k">for</span> <span class="o">(</span><span class="n">Element</span> <span class="n">image</span> <span class="o">:</span> <span class="n">images</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'> <span class="n">String</span> <span class="n">imgName</span> <span class="o">=</span> <span class="n">image</span><span class="o">.</span><span class="na">attr</span><span class="o">(</span><span class="s">"src"</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="c1">// we surppose image files are in the same folder with the html file.</span>
</span><span class='line'> <span class="n">File</span> <span class="n">tempImageFile</span> <span class="o">=</span> <span class="k">new</span> <span class="n">File</span><span class="o">(</span><span class="n">file</span><span class="o">.</span><span class="na">getParentFile</span><span class="o">().</span><span class="na">getAbsoluteFile</span><span class="o">()+</span><span class="s">"/"</span><span class="o">+</span> <span class="n">imgName</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="k">if</span> <span class="o">(</span><span class="n">tempImageFile</span><span class="o">.</span><span class="na">exists</span><span class="o">()</span> <span class="o">&&</span> <span class="n">imgName</span><span class="o">.</span><span class="na">trim</span><span class="o">()</span> <span class="o">!=</span> <span class="s">""</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'> <span class="n">String</span> <span class="n">imageString</span> <span class="o">=</span> <span class="k">new</span> <span class="n">String</span><span class="o">(</span>
</span><span class='line'>
</span><span class='line'> <span class="n">Base64</span><span class="o">.</span><span class="na">encodeBase64</span><span class="o">(</span><span class="n">FileUtils</span><span class="o">.</span><span class="na">readFileToByteArray</span><span class="o">(</span><span class="n">tempImageFile</span><span class="o">)));</span>
</span><span class='line'>
</span><span class='line'> <span class="n">image</span><span class="o">.</span><span class="na">attr</span><span class="o">(</span><span class="s">"src"</span><span class="o">,</span> <span class="s">"data:image;base64,"</span> <span class="o">+</span> <span class="n">imageString</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'>
</span><span class='line'> <span class="k">else</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'> <span class="c1">// if the image file not exist, just put a empty string in it or leave it as it was</span>
</span><span class='line'> <span class="n">image</span><span class="o">.</span><span class="na">attr</span><span class="o">(</span><span class="s">"src"</span><span class="o">,</span> <span class="s">"data:image;base64,"</span> <span class="o">+</span> <span class="s">""</span><span class="o">);</span>
</span><span class='line'>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'>
</span><span class='line'> <span class="n">final_return</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span>
</span><span class='line'>
</span><span class='line'> <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'> <span class="c1">//do stuff...</span>
</span><span class='line'> <span class="o">}</span>
</span><span class='line'>
</span><span class='line'> <span class="k">return</span> <span class="n">final_return</span><span class="o">;</span>
</span><span class='line'>
</span><span class='line'> <span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/27/about-java-socket/">Java Core Series 2: About Java Socket</a></h1>
<p class="meta">
<time datetime="2013-02-27T00:48:00-05:00" pubdate data-updated="true">Feb 27<span>th</span>, 2013</time>
| <a href="/blog/2013/02/27/about-java-socket/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>COMMING SOON …</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/27/about-java-io/">Java Core Series 1: About Java IO</a></h1>
<p class="meta">
<time datetime="2013-02-27T00:39:00-05:00" pubdate data-updated="true">Feb 27<span>th</span>, 2013</time>
| <a href="/blog/2013/02/27/about-java-io/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>COMMING SOON …</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/26/about-how-to-get-mime-types-using-java/">About How to Get Mime Types Using Java</a></h1>
<p class="meta">
<time datetime="2013-02-26T13:14:00-05:00" pubdate data-updated="true">Feb 26<span>th</span>, 2013</time>
| <a href="/blog/2013/02/26/about-how-to-get-mime-types-using-java/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p><em>1. using javax.activation.MimetypesFileTypeMap</em></p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='java'><span class='line'> <span class="n">File</span> <span class="n">f</span> <span class="o">=</span> <span class="k">new</span> <span class="n">File</span><span class="o">(</span><span class="s">"test.docx"</span><span class="o">);</span>
</span><span class='line'> <span class="n">String</span> <span class="n">mimeType</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MimetypesFileTypeMap</span><span class="o">().</span><span class="na">getContentType</span><span class="o">(</span><span class="n">f</span><span class="o">);</span>
</span></code></pre></td></tr></table></div></figure>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='java'><span class='line'><span class="nl">result:</span>
</span><span class='line'><span class="n">Mime</span> <span class="n">Type</span> <span class="n">of</span> <span class="o">.</span><span class="na">DS_Store</span> <span class="n">is</span> <span class="n">application</span><span class="o">/</span><span class="n">octet</span><span class="o">-</span><span class="n">stream</span>
</span><span class='line'><span class="n">Mime</span> <span class="n">Type</span> <span class="n">of</span> <span class="mi">444</span><span class="o">.</span><span class="na">docx</span> <span class="n">is</span> <span class="n">application</span><span class="o">/</span><span class="n">octet</span><span class="o">-</span><span class="n">stream</span>
</span><span class='line'><span class="n">Mime</span> <span class="n">Type</span> <span class="n">of</span> <span class="n">f</span><span class="o">.</span><span class="na">jar</span> <span class="n">is</span> <span class="n">application</span><span class="o">/</span><span class="n">octet</span><span class="o">-</span><span class="n">stream</span>
</span><span class='line'><span class="n">Mime</span> <span class="n">Type</span> <span class="n">of</span> <span class="n">Non</span><span class="o">-</span><span class="n">Disclosure</span> <span class="n">Agreement</span><span class="o">.</span><span class="na">docx</span> <span class="n">is</span> <span class="n">application</span><span class="o">/</span><span class="n">octet</span><span class="o">-</span><span class="n">stream</span>
</span><span class='line'><span class="n">Mime</span> <span class="n">Type</span> <span class="n">of</span> <span class="n">W9</span> <span class="n">Form</span><span class="o">.</span><span class="na">pddf</span> <span class="n">is</span> <span class="n">application</span><span class="o">/</span><span class="n">octet</span><span class="o">-</span><span class="n">stream</span>
</span></code></pre></td></tr></table></div></figure>
<p><em>2. Write yourself</em></p>
</div>
<footer>
<a rel="full-article" href="/blog/2013/02/26/about-how-to-get-mime-types-using-java/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/26/journal/">Journal</a></h1>
<p class="meta">
<time datetime="2013-02-26T00:14:00-05:00" pubdate data-updated="true">Feb 26<span>th</span>, 2013</time>
| <a href="/blog/2013/02/26/journal/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>今天做了一些关于Docx转换Html的研究, 发现Java现在并无什么很完美的解决方案, 主要是转换效果不佳, 公司想要的Header里的图片没有任何一个Java的开源解决方案可以完美的转换的. 一天搞来搞去, 没有任何成果. 这半年时间做开发的工作, 感觉自己并非非常关心具体的细节实现, 而是对数据传输和系统架构比较有兴趣. 未来怎么走, 变数还很大.</p>
<p>三月的目标:</p>
<ol>
<li>签证问题搞清楚, 争取准时寄出.</li>
<li>选择一门脚本语言或者更加高层的语言学习熟悉.</li>
<li>把pdftojson完善, 提高并发性能.</li>
<li>完善rtf,docx,doc to html, 提高并发性能.</li>
<li>最好把MQ实现出来.</li>
</ol>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/25/about-how-to-convert-docx-slash-doc-slash-rtf-into-html-using-java/">About How to Convert Docx/doc/rtf Into Html Using JAVA</a></h1>
<p class="meta">
<time datetime="2013-02-25T12:06:00-05:00" pubdate data-updated="true">Feb 25<span>th</span>, 2013</time>
| <a href="/blog/2013/02/25/about-how-to-convert-docx-slash-doc-slash-rtf-into-html-using-java/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>Actually, there is one solution, “One sulution to rule them all” . That is to use OpenOffice as the background service to convert them all. You can implement this remote call by yourself, but someone already wrote a java library to provide a high level API for us to use called JODConverter.</p>
<p>http://code.google.com/p/jodconverter/</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
</pre></td><td class='code'><pre><code class='java'><span class='line'> <span class="n">OfficeManager</span> <span class="n">officeManager</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DefaultOfficeManagerConfiguration</span><span class="o">()</span>
</span><span class='line'> <span class="c1">//2 ports indicate 2 working processes to do the conversion.</span>
</span><span class='line'> <span class="o">.</span><span class="na">setPortNumbers</span><span class="o">(</span><span class="mi">8100</span><span class="o">,</span> <span class="mi">8101</span><span class="o">)</span>
</span><span class='line'> <span class="c1">//restart openoffice working process after every 30 conversions to prevent memory leak of the working process. (unsolved issue of openoffice)</span>
</span><span class='line'> <span class="o">.</span><span class="na">setMaxTasksPerProcess</span><span class="o">(</span><span class="mi">30</span><span class="o">)</span>
</span><span class='line'> <span class="c1">//untouched tasks in the queue that over 1200000ms will be discarded.(get a officeManager not found exception)</span>
</span><span class='line'> <span class="o">.</span><span class="na">setTaskQueueTimeout</span><span class="o">(</span><span class="mi">1200000</span><span class="o">)</span>
</span><span class='line'> <span class="c1">//if one task processing time over 20000ms, it will throw an exception.</span>
</span><span class='line'> <span class="o">.</span><span class="na">setTaskExecutionTimeout</span><span class="o">(</span><span class="mi">20000</span><span class="o">)</span>
</span><span class='line'> <span class="o">.</span><span class="na">buildOfficeManager</span><span class="o">();</span>
</span><span class='line'>
</span><span class='line'> <span class="n">officeManager</span><span class="o">.</span><span class="na">start</span><span class="o">();</span>
</span><span class='line'> <span class="n">OfficeDocumentConverter</span> <span class="n">converter</span> <span class="o">=</span> <span class="k">new</span> <span class="n">OfficeDocumentConverter</span><span class="o">(</span><span class="n">officeManager</span><span class="o">);</span>
</span><span class='line'> <span class="n">converter</span><span class="o">.</span><span class="na">convert</span><span class="o">(</span><span class="k">new</span> <span class="n">File</span><span class="o">(</span><span class="n">filepath1</span><span class="o">),</span> <span class="k">new</span> <span class="n">File</span><span class="o">(</span><span class="n">filepath2</span><span class="o">));</span>
</span><span class='line'>
</span><span class='line'> <span class="n">officeManager</span><span class="o">.</span><span class="na">stop</span><span class="o">();</span>
</span></code></pre></td></tr></table></div></figure>
</div>
<footer>
<a rel="full-article" href="/blog/2013/02/25/about-how-to-convert-docx-slash-doc-slash-rtf-into-html-using-java/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/25/about-using-java-version-libsvm-do-classcification/">How to Use Libsvm to Do Classification With Java</a></h1>
<p class="meta">
<time datetime="2013-02-25T00:19:00-05:00" pubdate data-updated="true">Feb 25<span>th</span>, 2013</time>
| <a href="/blog/2013/02/25/about-using-java-version-libsvm-do-classcification/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p><strong>A real example from data preparing to train the model to finally do the classification included</strong></p>
<p>Comming soon…</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/02/24/chinese-language-test-in-octopress/">Octopress的中文使用测试</a></h1>
<p class="meta">
<time datetime="2013-02-24T22:39:00-05:00" pubdate data-updated="true">Feb 24<span>th</span>, 2013</time>
| <a href="/blog/2013/02/24/chinese-language-test-in-octopress/#disqus_thread">Comments</a>
</p>
</header>
<div class="entry-content"><p>试试中文在Octopress中的表现如何</p>
<p>测试文章:</p>
<p>来自美国宇航局太阳动力学天文台的最新观测,显示了太阳表面发生新的喷发事件。太阳耀斑和日冕物质抛射等太阳活动可导致外层结构出现的变化,这些复 杂的现象与太阳表面大气运动相联系,并受到磁场线的影响。在2012年7月19日,太阳表面爆发了一次强度较大的太阳耀斑事件,发射出大量的光和辐射,接 下来就是日冕物质抛射阶段,在磁场作用下,整个爆发事件变得异常诡异,这一现象被称为“日冕雨”。</p>
</div>
<footer>
<a rel="full-article" href="/blog/2013/02/24/chinese-language-test-in-octopress/">Read on →</a>
</footer>
</article>
<div class="pagination">
<a class="prev" href="/blog/page/2/">← Older</a>
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>About Me</h1>
<br/>
<img class="center" src="/images/icon1.jpg" width="150" height="150" title="‘image’ ‘images’" >
<p>An architect who build the future with code … </p>
<p>程序员?码农?做IT的? 我不喜欢这些名字. 我是一个建筑师, 用代码来构建未来.</p>
<p>email: [email protected]</p>
</section>
<section>
<h1>Categories</h1>
<ul id="categories">
<li class='category'><a href='/blog/categories/core/'>CORE (2)</a></li>
<li class='category'><a href='/blog/categories/doc/'>DOC (1)</a></li>
<li class='category'><a href='/blog/categories/docx/'>DOCX (1)</a></li>
<li class='category'><a href='/blog/categories/font/'>FONT (1)</a></li>
<li class='category'><a href='/blog/categories/html/'>HTML (1)</a></li>
<li class='category'><a href='/blog/categories/image/'>IMAGE (1)</a></li>
<li class='category'><a href='/blog/categories/io/'>IO (1)</a></li>
<li class='category'><a href='/blog/categories/java/'>JAVA (7)</a></li>
<li class='category'><a href='/blog/categories/journal/'>JOURNAL (1)</a></li>
<li class='category'><a href='/blog/categories/machine-learning/'>MACHINE_LEARNING (1)</a></li>
<li class='category'><a href='/blog/categories/nodejs/'>NODEJS (1)</a></li>
<li class='category'><a href='/blog/categories/octopress/'>OCTOPRESS (2)</a></li>
<li class='category'><a href='/blog/categories/pdf/'>PDF (1)</a></li>
<li class='category'><a href='/blog/categories/phantomjs/'>PHANTOMJS (1)</a></li>
<li class='category'><a href='/blog/categories/rtf/'>RTF (1)</a></li>
<li class='category'><a href='/blog/categories/socket/'>SOCKET (1)</a></li>
<li class='category'><a href='/blog/categories/svm/'>SVM (1)</a></li>
<li class='category'><a href='/blog/categories/test/'>TEST (1)</a></li>
<li class='category'><a href='/blog/categories/utility/'>UTILITY (1)</a></li>
</ul>
</section><section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2013/03/13/about-how-to-design-a-worker-queue-style-node-js-application-server/">About how to design a worker queue style node js application server</a>
</li>
<li class="post">
<a href="/blog/2013/03/07/about-how-to-make-phantomjs-support-google-web-fonts/">About how to make phantomjs render google embeded web fonts correctly</a>
</li>
<li class="post">
<a href="/blog/2013/02/27/about-how-to-embed-image-into-one-single-html/">About how to embed image into one single html</a>
</li>
<li class="post">
<a href="/blog/2013/02/27/about-java-socket/">Java Core Series 2: About Java Socket</a>
</li>
<li class="post">
<a href="/blog/2013/02/27/about-java-io/">Java Core Series 1: About Java IO</a>
</li>
</ul>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright © 2013 - squallssck -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript">
var disqus_shortname = 'kcsjavaworld';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
</body>
</html>