星期一, 8月 29, 2011

Uncaught Error: can't load XRegExp twice in the same frame

在Chrome上debug會出現 Uncaught Error: can't load XRegExp twice in the same frame 已經不是一天兩天的問題了。然而雖然有警告,程式卻都跑得好好的我也就不管它了XD
今天總算是在這裡查到原因了


Chrome: Uncaught Error: can't load XRegExp twice in the same frame


Question:

The following code will fail in both of my chromes on 2 different computers (Windows 7 both of them, Chrome 12.0.742.100).


<script type="text/javascript">
location.hash = "#one";
location.hash = "#two";
location.hash = "#three";
</script>


I feel like I tried everything. Can anyone confirm this error on chrome, and does anyone have an idea as to how I fix it? Thanks a lot.


Answer:

It works fine with me on Chrome 12.0.742.100 on Win7. I'm assuming you have installed extensions? disable all extensions (or go to incognito mode) and try to load your page again. Errors from content scripts are also displayed in the javascript console. If you are not using XRegExp on your page, probably one of the extensions does.

Edit:

The source of the exception should be located to the right. Click it to go to the script that caused the exception.

Report:
I have no clue how I cannot have thought of this. You were completely correct, it was the chrome extension "XML Viewer". Thanks.



結論就是:
很有可能是因為chrome的某些plugin造成的問題,而且使用者那邊裝什麼plugin我們也管不著
既然束手無策而且也不會造成crash,就繼續不管它囉

星期二, 8月 09, 2011

C#內嵌WMP用法


右擊工具箱->選擇項(I)... -> 顯示"選擇工具箱項" -> COM組件 -> Windows Media Player   wmp.dll 添加

axWindowsMediaPlayer1.windowlessVideo = false; //設為false後雙擊屏幕可以全屏
axWindowsMediaPlayer1.fullScreen = true; //設播放器全屏播放

axWindowsMediaPlayer1.URL = @"mms://192.168.0.102/vod/jingwei.wma";

axWindowsMediaPlayer1.Ctlcontrols.play(); //播放
axWindowsMediaPlayer1.Ctlcontrols.stop(); //停止
axWindowsMediaPlayer1.Ctlcontrols.pause(); //暫停

axWindowsMediaPlayer1.settings.autoStart = true; //自動播放

axWindowsMediaPlayer1.settings.mute = false; //靜音
axWindowsMediaPlayer1.settings.volume = 100; //音量 int 0 ~ 100   100 是最大音量

axWindowsMediaPlayer1.currentMedia.duration.ToString();//影片長度
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 30; //當前的播放位置 double

axWindowsMediaPlayer1.currentMedia.getItemInfo("Title");//標題
axWindowsMediaPlayer1.currentMedia.getItemInfo("Author");//作者

//*****************************************************************************//

MediaPlay 以前版本

右擊工具箱->選擇項(I)... -> 顯示"選擇工具箱項" -> COM組件 -> 瀏覽(B)... -> C:WINDOWS\system32\msdxm.ocx -> 打開
Windows Media Player   msdxm.dll 添加

label4.Text = axMediaPlayer1.Volume.ToString(); //音量
axMediaPlayer1.FileName = @"mms://218.98.101.164/vod/jingwei.wma";//文件路徑
axMediaPlayer1.Play(); //開始播放

//******************************************************************************//
//****************************************************************************//

右擊工具箱->選擇項(I)... -> 顯示"選擇工具箱項" -> COM組件 -> RealPlayer G2 Control   rmoc3260.dll 添加

axRealAudio1.Source = @"F:\mp3\hh.mp3"; //播放路徑

axRealAudio1.CanPlayPause(); //Bool 型是否能暫停
axRealAudio1.CanPause(); //暫停
axRealAudio1.DoPlayPause(); //正在播放的影片暫停播放

axRealAudio1.CanPlay(); //Bool是否能播放
axRealAudio1.DoPlay(); //播放

axRealAudio1.CanStop() //播放是否可以停止
axRealAudio1.DoStop(); //播放停止

axRealAudio1.SetCenter(true); //按影片原大小播放
axRealAudio1.SetFullScreen();//播放器全屏播放影片

int place = axRealAudioP.GetPosition();
axRealAudio1.DoStop();
axRealAudio1.SetCente*(**lse); //拉伸播放 axRealAudio1.SetCenter(true); 按影片原始大小播放
axRealAudio1.DoPlay();
axRealAudio1.SetPosition(place);

nResL = axRealAudio1.GetPosition(); //獲得當前影片 的播放進度
label1.Text = axRealAudio1.GetTitle(); //獲得影片的標題
label2.Text = "當前的帶寬: " + axRealAudio1.GetBandwidthCurrent() / 1024 + "KB";//當前影片的當前的帶寬
label3.Text = "連接的帶寬: " + axRealAudio1.GetConnectionBandwidth() / 1024 + "KB"; //當前的連接的帶寬


參考 http://www.csharpwin.com/csharpspace/9028r9970.shtml