-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
866 lines (469 loc) · 36 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
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
<!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>大小麦哲伦</title>
<meta name="author" content="zhongdechan">
<meta name="description" content="当点击后退按钮返回之前访问过的页面时,该网页上的脚本将无法再运行。 解决办法 设置一个空的window.onunload函数 e.g. Javascript1
2
3
4
5
6
<html><body>
<script type="text/ …">
<!-- 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://zhongdechan.github.io">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="大小麦哲伦" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/libs/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--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">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30173088-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">大小麦哲伦</a></h1>
<h2>名字叫阿花,摇着尾巴 ... ...</h2>
</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:zhongdechan.github.io" />
<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>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/04/25/history-back-javascript-not-run/">浏览器后退js不执行</a></h1>
<p class="meta">
<time datetime="2014-04-25T22:41:34+08:00" pubdate data-updated="true">Apr 25<span>th</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>当点击后退按钮返回之前访问过的页面时,该网页上的脚本将无法再运行。</p>
<p>解决办法 设置一个空的window.onunload函数</p>
<p>e.g.</p>
<figure class='code'><figcaption><span>Javascript</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='html'><span class='line'><span class="nt"><html><body></span>
</span><span class='line'><span class="nt"><script </span><span class="na">type=</span><span class="s">"text/javascript"</span><span class="nt">></span>
</span><span class='line'> <span class="nb">window</span><span class="p">.</span><span class="nx">onload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="nx">alert</span><span class="p">(</span><span class="s1">'页面加载运行.'</span><span class="p">);</span> <span class="p">};</span>
</span><span class='line'> <span class="nb">window</span><span class="p">.</span><span class="nx">onunload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){};</span>
</span><span class='line'><span class="nt"></script></span>
</span><span class='line'><span class="nt"></body></html></span>
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/10/12/showmodaldialog-chrome/">Chrome下showModalDialog dialogWidth长度属性无效</a></h1>
<p class="meta">
<time datetime="2012-10-12T09:29:00+08:00" pubdate data-updated="true">Oct 12<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>在Chrome浏览器下调用window.showModalDialog 会忽略dialogWidth和dialogHeight属性,其他浏览器IE,firefox却显示正常。<br/>
原因是Chrome下dialogWidth和dialogHeight的值<strong>不能带”px”后缀</strong>.正确写法<code>"dialogWidth:100;dialogHeight:200"</code> <br/>
但其他浏览器则相反需要带有”px”后缀,例如:<code>"dialogWidth:100px;dialogHeight:200px"</code></p>
<p>要兼容所有浏览器需要判断浏览器类型,参考代码:</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>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
</pre></td><td class='code'><pre><code class='javascript'><span class='line'><span class="kd">function</span> <span class="nx">ModalDialog</span><span class="p">(</span><span class="nx">sURL</span><span class="p">,</span> <span class="nx">vArguments</span><span class="p">,</span> <span class="nx">ModalDialogHeight</span><span class="p">,</span> <span class="nx">ModalDialogWidth</span><span class="p">)</span> <span class="p">{</span>
</span><span class='line'> <span class="kd">var</span> <span class="nx">sFeatures</span><span class="p">;</span>
</span><span class='line'> <span class="k">if</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">showModalDialog</span><span class="p">)</span> <span class="p">{</span><span class="c1">//判断浏览器是否支持showModalDialog函数</span>
</span><span class='line'> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">userAgent</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">().</span><span class="nx">match</span><span class="p">(</span><span class="s1">'chrome'</span><span class="p">))</span> <span class="p">{</span><span class="c1">//非chrome浏览器添加px</span>
</span><span class='line'> <span class="nx">ModalDialogWidth</span> <span class="o">+=</span> <span class="s2">"px"</span><span class="p">;</span>
</span><span class='line'> <span class="nx">ModalDialogHeight</span> <span class="o">+=</span> <span class="s2">"px"</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="nx">sFeatures</span> <span class="o">=</span> <span class="s2">"status:no;center:yes;dialogWidth:"</span> <span class="o">+</span> <span class="nx">ModalDialogWidth</span> <span class="o">+</span> <span class="s2">";dialogHeight:"</span> <span class="o">+</span> <span class="nx">ModalDialogHeight</span> <span class="o">+</span> <span class="s2">";resizable:yes;"</span><span class="p">;</span>
</span><span class='line'> <span class="kd">var</span> <span class="nx">returnResult</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">showModalDialog</span><span class="p">(</span><span class="nx">sURL</span><span class="p">,</span> <span class="nx">vArguments</span><span class="p">,</span> <span class="nx">sFeatures</span><span class="p">);</span>
</span><span class='line'> <span class="k">if</span> <span class="p">(</span><span class="nx">returnResult</span><span class="p">)</span> <span class="p">{</span>
</span><span class='line'> <span class="k">return</span> <span class="nx">returnResult</span><span class="p">;</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="k">else</span> <span class="p">{</span><span class="c1">//使用window.open替代showModalDialog</span>
</span><span class='line'> <span class="nx">sFeatures</span> <span class="o">=</span> <span class="s2">"status=no,width="</span> <span class="o">+</span> <span class="nx">ModalDialogWidth</span> <span class="o">+</span> <span class="s2">",height="</span> <span class="o">+</span> <span class="nx">ModalDialogHeight</span> <span class="o">+</span> <span class="s2">",menubar=no,scrollbars=no"</span><span class="p">;</span>
</span><span class='line'> <span class="nb">window</span><span class="p">.</span><span class="nx">margs</span> <span class="o">=</span> <span class="nx">vArguments</span><span class="p">;</span>
</span><span class='line'> <span class="nb">window</span><span class="p">.</span><span class="nx">open</span><span class="p">(</span><span class="nx">sURL</span><span class="p">,</span> <span class="s2">"_blank"</span><span class="p">,</span> <span class="nx">sFeatures</span><span class="p">);</span>
</span><span class='line'> <span class="p">}</span>
</span><span class='line'> <span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/10/12/ubuntu-tomcat-dir/">Ubuntu Tomcat 目录</a></h1>
<p class="meta">
<time datetime="2012-10-12T09:13:00+08:00" pubdate data-updated="true">Oct 12<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>在ubuntu系统上使用apt-get安装tomcat的目录结构:</p>
<ul>
<li><p>/etc/tomcat7 – 全局配置</p></li>
<li><p>/usr/share/tomcat7/ – 程序主目录</p></li>
<li><p>/usr/share/tomcat7/conf/Catalina/localhost/ – 本机部署的 Catalina 配置</p></li>
<li><p>/var/lib/tomcat7/ – 工作主目录</p></li>
<li><p>/var/lib/tomcat7/webapps – (应用文件war包放在这里)</p></li>
<li><p>/var/lib/tomcat7/work</p></li>
</ul>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/10/11/hibernate-many-to-many-query/">Hibernate多对多查询</a></h1>
<p class="meta">
<time datetime="2012-10-11T09:35:00+08:00" pubdate data-updated="true">Oct 11<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>示例:每篇文章(article)与标签(tag)为多对多关系<br/>
<img src="http://ww2.sinaimg.cn/large/a74ecc4cjw1dxr0mgy0vdj.jpg" alt="img" /><br/>
Hibernate 映射:</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>
</pre></td><td class='code'><pre><code class='xml'><span class='line'><span class="nt"><hibernate-mapping></span>
</span><span class='line'> <span class="nt"><class</span> <span class="na">name=</span><span class="s">"com.sample.model.Tag"</span> <span class="na">table=</span><span class="s">"tag"</span><span class="nt">></span>
</span><span class='line'> <span class="nt"><cache</span> <span class="na">usage=</span><span class="s">"read-write"</span><span class="nt">/></span>
</span><span class='line'> <span class="nt"><id</span> <span class="na">name=</span><span class="s">"id"</span> <span class="na">column=</span><span class="s">"id"</span> <span class="na">type=</span><span class="s">"long"</span><span class="nt">></span>
</span><span class='line'> <span class="nt"><generator</span> <span class="na">class=</span><span class="s">"native"</span><span class="nt">/></span>
</span><span class='line'> <span class="nt"></id></span>
</span><span class='line'> <span class="nt"><property</span> <span class="na">name=</span><span class="s">"name"</span> <span class="na">column=</span><span class="s">"name"</span><span class="nt">/></span>
</span><span class='line'> <span class="nt"></class></span>
</span><span class='line'><span class="nt"></hibernate-mapping></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>
<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>
</pre></td><td class='code'><pre><code class='xml'><span class='line'><span class="nt"><hibernate-mapping></span>
</span><span class='line'> <span class="nt"><class</span> <span class="na">name=</span><span class="s">"com.sample.model.Article"</span> <span class="na">table=</span><span class="s">"article"</span><span class="nt">></span>
</span><span class='line'> <span class="nt"><cache</span> <span class="na">usage=</span><span class="s">"read-write"</span> <span class="nt">/></span>
</span><span class='line'> <span class="nt"><id</span> <span class="na">name=</span><span class="s">"id"</span> <span class="na">column=</span><span class="s">"id"</span> <span class="na">type=</span><span class="s">"long"</span><span class="nt">></span>
</span><span class='line'> <span class="nt"><generator</span> <span class="na">class=</span><span class="s">"native"</span> <span class="nt">/></span>
</span><span class='line'> <span class="nt"></id></span>
</span><span class='line'> <span class="nt"><property</span> <span class="na">name=</span><span class="s">"title"</span> <span class="na">column=</span><span class="s">"title"</span> <span class="nt">/></span>
</span><span class='line'> <span class="nt"><set</span> <span class="na">name=</span><span class="s">"tags"</span> <span class="na">table=</span><span class="s">"article_tag"</span> <span class="na">lazy=</span><span class="s">"false"</span><span class="nt">></span>
</span><span class='line'> <span class="nt"><key</span> <span class="na">column=</span><span class="s">"articleid"</span> <span class="nt">/></span>
</span><span class='line'> <span class="nt"><many-to-many</span> <span class="na">class=</span><span class="s">"com.sample.model.Tag"</span> <span class="na">column=</span><span class="s">"tagid"</span> <span class="nt">/></span>
</span><span class='line'> <span class="nt"></set></span>
</span><span class='line'> <span class="nt"></class></span>
</span><span class='line'><span class="nt"></hibernate-mapping></span>
</span></code></pre></td></tr></table></div></figure>
<h4>1. 根据标签(tag)查询文章(article)</h4>
<p>MYSQL查询语句:查询标签为 “Java” 或者 标签为”Hibernate” 的文章</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>
</pre></td><td class='code'><pre><code class='sql'><span class='line'><span class="k">SELECT</span> <span class="k">DISTINCT</span> <span class="n">a</span><span class="p">.</span><span class="o">*</span>
</span><span class='line'><span class="k">FROM</span> <span class="o">`</span><span class="n">article</span><span class="o">`</span> <span class="n">a</span>
</span><span class='line'> <span class="k">INNER</span> <span class="k">JOIN</span> <span class="n">article_tag</span> <span class="k">at</span>
</span><span class='line'> <span class="k">ON</span> <span class="k">at</span><span class="p">.</span><span class="n">articleid</span> <span class="o">=</span> <span class="n">a</span><span class="p">.</span><span class="n">id</span>
</span><span class='line'> <span class="k">INNER</span> <span class="k">JOIN</span> <span class="n">tag</span> <span class="n">t</span>
</span><span class='line'> <span class="k">ON</span> <span class="n">t</span><span class="p">.</span><span class="n">id</span> <span class="o">=</span> <span class="k">at</span><span class="p">.</span><span class="n">tagid</span>
</span><span class='line'><span class="k">WHERE</span> <span class="n">t</span><span class="p">.</span><span class="n">name</span> <span class="k">IN</span> <span class="p">(</span><span class="ss">"Java"</span><span class="p">,</span> <span class="ss">"Hibernate"</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>
<p>Hibernate HQL:</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>
</pre></td><td class='code'><pre><code class='java'><span class='line'><span class="n">String</span><span class="o">[]</span> <span class="n">tags</span> <span class="o">=</span> <span class="o">{</span><span class="s">"Java"</span><span class="o">,</span> <span class="s">"Hibernate"</span><span class="o">};</span>
</span><span class='line'><span class="n">String</span> <span class="n">hql</span> <span class="o">=</span> <span class="s">"select distinct a from Article a "</span> <span class="o">+</span>
</span><span class='line'> <span class="s">"join a.tags t "</span> <span class="o">+</span>
</span><span class='line'> <span class="s">"where t.name in (:tags)"</span><span class="o">;</span>
</span><span class='line'><span class="n">Query</span> <span class="n">query</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createQuery</span><span class="o">(</span><span class="n">hql</span><span class="o">);</span>
</span><span class='line'><span class="n">query</span><span class="o">.</span><span class="na">setParameterList</span><span class="o">(</span><span class="s">"tags"</span><span class="o">,</span> <span class="n">tags</span><span class="o">);</span>
</span><span class='line'><span class="n">List</span><span class="o"><</span><span class="n">Article</span><span class="o">></span> <span class="n">articles</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="na">list</span><span class="o">();</span>
</span></code></pre></td></tr></table></div></figure>
</div>
<footer>
<a rel="full-article" href="/blog/2012/10/11/hibernate-many-to-many-query/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/10/10/mac-windows-time-tongbu/">解决Windows与Mac时间不同步</a></h1>
<p class="meta">
<time datetime="2012-10-10T09:48:00+08:00" pubdate data-updated="true">Oct 10<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>安装Windows 和 Mac 苹果双系统后,系统时间出现不同步。有两种简单的解决办法:</p>
<ul>
<li>方法一:在Mac下<code>系统编好设置</code> -> <code>时间与日期</code> –> <code>时区</code> 最接近的城市选择为<code>雷克雅未克 - 冰岛</code></li>
</ul>
<p><img src="http://ww3.sinaimg.cn/large/a74ecc4cjw1dxpvrxc7f8j.jpg" alt="Smaller icon" /></p>
<ul>
<li>方法二:修改windows注册表,在<code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\</code>中加一项DWORD,<code>RealTimeIsUniversal</code>,把值设为 <strong>1</strong>。</li>
</ul>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/10/09/octopress-faq-wenti/">Octopress 常见问题</a></h1>
<p class="meta">
<time datetime="2012-10-09T14:12:00+08:00" pubdate data-updated="true">Oct 9<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><ul>
<li><strong>Mountain Lion 编译报错extconf.rb:21:in `<main>‘: Only Darwin systems</strong></li>
</ul>
<p>Mountain Lion执行bundle install的时候,会给出下面的报错:</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>
</pre></td><td class='code'><pre><code class='tex'><span class='line'>creating Makefile
</span><span class='line'>extconf.rb:21:in `<main>': Only Darwin systems
</span><span class='line'>greater than 8 (Mac OS X 10.5+) are supported (RuntimeError)
</span></code></pre></td></tr></table></div></figure>
<p>这个报错的原因是octopress需要的<code>rb-fsevent</code>的版本是<code>0.4.3.1</code>,这个版本还不支持<code>Mountain Lion</code>。
简单的处理办法是修改~/.rvm/gems/ruby-1.9.3-p194/gems/rb-fsevent-0.4.3.1/ext/extconf.rb文件,找到19行,如下:</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>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">sdk_version</span> <span class="o">=</span> <span class="o">{</span> <span class="nv">9</span> <span class="o">=</span>> <span class="s1">'10.5'</span>, <span class="nv">10</span> <span class="o">=</span>> <span class="s1">'10.6'</span>, <span class="nv">11</span> <span class="o">=</span>> <span class="s1">'10.7'</span> <span class="o">}[</span>darwin_version<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>
<p>修改为</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>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">sdk_version</span> <span class="o">=</span> <span class="o">{</span> <span class="nv">9</span> <span class="o">=</span>> <span class="s1">'10.5'</span>, <span class="nv">10</span> <span class="o">=</span>> <span class="s1">'10.6'</span>, <span class="nv">11</span> <span class="o">=</span>> <span class="s1">'10.7'</span>,12<span class="o">=</span>><span class="s1">'10.8'</span> <span class="o">}[</span>darwin_version<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>
<p>删除第24行内容,如下</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>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>-isysroot <span class="c">#{xcode_path}/SDKs/MacOSX#{sdk_version}.sdk</span>
</span></code></pre></td></tr></table></div></figure>
<p>然后执行<code>bundle update</code>编译安装即可。</p>
</div>
<footer>
<a rel="full-article" href="/blog/2012/10/09/octopress-faq-wenti/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/03/21/dell-vostro-v131-mac-lion/">Dell Vostro V131 Mac Lion 完美安装</a></h1>
<p class="meta">
<time datetime="2012-03-21T20:29:00+08:00" pubdate data-updated="true">Mar 21<span>st</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>安装黑苹果真的很折腾,近来同事在v131上完美安装了lion,足足花了一天,不断的重启不断滴尝试。建议想用苹果的还是直接买白苹果省心。</p>
<h3>安装情况</h3>
<p>CPU:Core i3 (完美)
主板: Intel HM 55 (完美)
显卡:HD Graphics 3000 (QE/CI完美)
声卡 (完美无爆音)
集成 摄像头/Mic (完美)
2x USB 3.0 (完美)
1 USB 2.0 (完美)
触摸板:(两点触摸 完美)
SD Card reader(完美)
蓝牙(无驱动)
WiFi(无驱动) 这款卡太老,没驱动的,建议买个usb网卡替代。<a href="http://www.360buy.com/product/389343.html">EDUP EP-N8513 隐藏型无线网卡</a></p>
</div>
<footer>
<a rel="full-article" href="/blog/2012/03/21/dell-vostro-v131-mac-lion/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/03/17/mac-linux-android-adb-vendorid/">Mac Linux Android Adb vendorId</a></h1>
<p class="meta">
<time datetime="2012-03-17T14:39:00+08:00" pubdate data-updated="true">Mar 17<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>android adb连接不到设备一般有2种解决方法:</p>
<ol>
<li>在adb_usb.ini文件下添加vendor id;</li>
<li>去市场下载个adb wireless通过这个wifi’进行连接</li>
</ol>
<div>adb wireless很方便,网上很多教程,这里就不说了。这里主要说明一下这个vendor id怎么来。</div>
<div> </div>
<div>首先确定在用户目录~/.android/adb_usb.ini文件存在,如果没有需要运行以下命令生成</div>
<div>
<pre class="brush: bash; gutter: false; toolbar: false; auto-links: false; wrap-lines: false">android update adb</pre>
</div>
<div>在<strong>Linux</strong>下运行lsusb命令,命令结果为</div>
<div><pre class="brush: bash; gutter: false; toolbar: false; auto-links: false; wrap-lines: false">Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0e79:1411 Archos, Inc.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub</pre>
</div>
<div>从列表中找到android设备名称,我的是Archos所以id为<span class="Apple-style-span" style="white-space: pre;"
data-mce-style="white-space: pre;">0e79</span>
</div>
<div><span class="Apple-style-span" style="white-space: pre;" data-mce-style="white-space: pre;">在adb_usb.ini上填入id的时候需要添加0x开头,填写0x0e79。每行一个id。</span>
</div>
<div><span class="Apple-style-span" style="white-space: pre;" data-mce-style="white-space: pre;"><br></span></div>
<div><span class="Apple-style-span" style="white-space: pre;" data-mce-style="white-space: pre;"><strong>在Mac</strong> 系统查看命令不同,运行的命令为</span>
</div>
<div>
<pre class="brush: bash; gutter: false; toolbar: false; auto-links: false; wrap-lines: false">system_profiler SPUSBDataType</pre>
</div>
<div> </div>
<div> </div>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/02/15/parallels-shard-number-0-network/">Parallels Shard #0 Network</a></h1>
<p class="meta">
<time datetime="2012-02-15T18:37:00+08:00" pubdate data-updated="true">Feb 15<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>在mac lion下Parallels Desktop 7运行性能比vm快多了,启动xp欢迎界面都没看清楚就进去了,非常强悍。
之前在pd7下安装了xp,后来不记得弄过什么网络配置,可能删除了无线网络之类的。
今天进入pd7提示“在 <em>您mac上没有网络适配器为</em> Parallels shard #0虚拟网络。该网络适配器0将被断开。”
修复方法是在pd7菜单:<strong>偏好设置-高级-网络“更改设置”-恢复默认设置;</strong>然后重启pd7就可以了</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2011/11/14/twitter-bootstrap-modal-auto-hide/">Twitter Bootstrap Modal插件点击背景自动消失</a></h1>
<p class="meta">
<time datetime="2011-11-14T10:31:00+08:00" pubdate data-updated="true">Nov 14<span>th</span>, 2011</time>
</p>
</header>
<div class="entry-content"><p>我是在Twitter Bootstrap2.0.1中遇到这个问题。
问题描述:
直接调用</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>
</pre></td><td class='code'><pre><code class='javascript'><span class='line'><span class="nx">$</span><span class="p">(</span><span class="s1">'#myModal'</span><span class="p">).</span><span class="nx">modal</span><span class="p">(</span><span class="s1">'show'</span><span class="p">)</span><span class="err">;</span>
</span></code></pre></td></tr></table></div></figure>
<p>显示的Modal存在一个问题,就是当你鼠标点击Modal后面的背景,Modal会自动隐藏消失!!!
只要添加一个参数就可以解决这个问题</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>
</pre></td><td class='code'><pre><code class='javascript'><span class='line'><span class="nx">$</span><span class="p">(</span><span class="s1">'#myModal'</span><span class="p">).</span><span class="nx">modal</span><span class="p">(</span><span class="nx">backdrop</span><span class="o">:</span><span class="s1">'static'</span><span class="p">);</span>
</span></code></pre></td></tr></table></div></figure>
<p>官方文档显示backdrop的类型是boolean,实际上设置true和false都不行,文档上有错误应该为String类型才对</p>
</div>
</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>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2014/04/25/history-back-javascript-not-run/">浏览器后退js不执行</a>
</li>
<li class="post">
<a href="/blog/2012/10/12/showmodaldialog-chrome/">Chrome下showModalDialog dialogWidth长度属性无效</a>
</li>
<li class="post">
<a href="/blog/2012/10/12/ubuntu-tomcat-dir/">Ubuntu Tomcat 目录</a>
</li>
<li class="post">
<a href="/blog/2012/10/11/hibernate-many-to-many-query/">Hibernate多对多查询</a>
</li>
<li class="post">
<a href="/blog/2012/10/10/mac-windows-time-tongbu/">解决Windows与Mac时间不同步</a>
</li>
</ul>
</section>
<section>
<h1>标签云</h1>
<span id="tag-cloud"><a href='/blog/categories/android' style='font-size: 115.0%'>Android(1)</a> <a href='/blog/categories/css' style='font-size: 130.0%'>CSS(2)</a> <a href='/blog/categories/grails' style='font-size: 130.0%'>Grails(2)</a> <a href='/blog/categories/java' style='font-size: 130.0%'>JAVA(2)</a> <a href='/blog/categories/javascript' style='font-size: 115.0%'>Javascript(1)</a> <a href='/blog/categories/javascript' style='font-size: 115.0%'>javascript(1)</a> <a href='/blog/categories/linux' style='font-size: 115.0%'>Linux(1)</a> <a href='/blog/categories/mac' style='font-size: 160.0%'>Mac(4)</a> <a href='/blog/categories/mobile' style='font-size: 115.0%'>Mobile(1)</a> <a href='/blog/categories/web' style='font-size: 130.0%'>Web(2)</a> </span>
</section>
<section>
<h1>博客分类</h1>
<ul id="category-list"><li><a href='/blog/categories/android'>Android (1)</a></li><li><a href='/blog/categories/css'>CSS (2)</a></li><li><a href='/blog/categories/grails'>Grails (2)</a></li><li><a href='/blog/categories/java'>JAVA (2)</a></li><li><a href='/blog/categories/javascript'>Javascript (1)</a></li><li><a href='/blog/categories/javascript'>javascript (1)</a></li><li><a href='/blog/categories/linux'>Linux (1)</a></li><li><a href='/blog/categories/mac'>Mac (4)</a></li><li><a href='/blog/categories/mobile'>Mobile (1)</a></li><li><a href='/blog/categories/web'>Web (2)</a></li></ul>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright © 2014 - zhongdechan -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript">
var disqus_shortname = 'zhongdechansblog';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + 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 = '//platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
</body>
</html>