原先可以正常使用的 語言學習 網站,近期一直不穩,甚至完全不能使用
之後查明原因為 Google 要停止這個功能
網路上有人建議使用 GitHub,但試過後發現,GitHub 可能也不支援了
目前將網頁搬至 000webhost,免費網路空間,目前感覺很棒
雖然該網站曾經被駭客入侵,但是我想它會改善,何況我也只是放單純的網頁
2016年10月13日 星期四
2016年9月6日 星期二
SpeechSynthesisUtterance 無法說中文
之前參考 Speech Synthesis API 製作 語音學習站
發現其中 中文的發音 在部分電腦可以正常發音,有些則不行
之後參考 SpeechSynthesisUtterance、Getting Started with the Speech Synthesis API 修正
// Chrome loads voices asynchronously.
window.speechSynthesis.onvoiceschanged = function(e) {
var synth = window.speechSynthesis;
voices = synth.getVoices();
var voice_1 = document.getElementById('voice_1');
while (voice_1.options.length) {
voice_1.remove(0);
}
var voice_2 = document.getElementById('voice_2');
while (voice_2.options.length) {
voice_2.remove(0);
}
voices.forEach(function(voice, i) {
var opt1 = document.createElement("option");
opt1.textContent = voice.name + ' (' + voice.lang + ")";
opt1.setAttribute('data-lang', voice.lang);
opt1.setAttribute('data-name', voice.name);
if (voice.lang == "en-US") {
opt1.selected = true;
}
voice_1.appendChild(opt1);
});
發現其中 中文的發音 在部分電腦可以正常發音,有些則不行
之後參考 SpeechSynthesisUtterance、Getting Started with the Speech Synthesis API 修正
// Chrome loads voices asynchronously.
window.speechSynthesis.onvoiceschanged = function(e) {
var synth = window.speechSynthesis;
voices = synth.getVoices();
var voice_1 = document.getElementById('voice_1');
while (voice_1.options.length) {
voice_1.remove(0);
}
var voice_2 = document.getElementById('voice_2');
while (voice_2.options.length) {
voice_2.remove(0);
}
voices.forEach(function(voice, i) {
var opt1 = document.createElement("option");
opt1.textContent = voice.name + ' (' + voice.lang + ")";
opt1.setAttribute('data-lang', voice.lang);
opt1.setAttribute('data-name', voice.name);
if (voice.lang == "en-US") {
opt1.selected = true;
}
voice_1.appendChild(opt1);
});
2015年10月22日 星期四
2015年1月22日 星期四
語言學習程式 LearnLang
原先已經在 android 上寫好程式,而且也能使用
為了頁籤的順序不對
1.將 Google App Script 之 SheetAsJSON 改為 SheetAsJSON2
主要是將頁籤使用 JSON 的 Array 傳送
2.原先以為事情到此為止
哪知道儲存於資料庫時,照著頁籤名稱排序
只好修改資料庫
3.因為動了資料庫,所以全部重新下載,下載到一半居然停了,
google 回覆說不給機器程式使用發音
加入
conn.setRequestProperty("Range", "bytes=0-");
conn.setRequestProperty("Accept-Encoding", "identity");
為了頁籤的順序不對
1.將 Google App Script 之 SheetAsJSON 改為 SheetAsJSON2
主要是將頁籤使用 JSON 的 Array 傳送
2.原先以為事情到此為止
哪知道儲存於資料庫時,照著頁籤名稱排序
只好修改資料庫
3.因為動了資料庫,所以全部重新下載,下載到一半居然停了,
google 回覆說不給機器程式使用發音
加入
conn.setRequestProperty("Range", "bytes=0-");
conn.setRequestProperty("Accept-Encoding", "identity");
2014年10月15日 星期三
語言學習站 IE11 也可以
<audio> 在 IE 真的不好用
還是舊的 <bgSound>
雖然 IE8 上的 ajax.responseText 一直是 undefined
但是 IE11 上成功了。
還是舊的 <bgSound>
雖然 IE8 上的 ajax.responseText 一直是 undefined
但是 IE11 上成功了。
2014年6月17日 星期二
英文學習站 忽然死了
經過查證
發出 request
https://googledrive.com/host/0B7u4moMmo8nDMDJuTmxSMGptUmc?ti=%u9673%u5E73%u82F1%u6587%u4E94%u4E0B_Unit1&id=1bXGGbmey3BTWtvZDdHLVwFHgEUNERXtzHSEucaBt6cs
回覆: status 301
轉成
https://079d23e82a287d32341893c3a6d0d7c6f9632316.googledrive.com/host/0B7u4moMmo8nDMDJuTmxSMGptUmc
此時掉了 query string
建立 EnglishClass.html,將課程列表放入
將 Google Drive 的目錄 share,在 share folder 內可以直接使用檔名
發出 request
https://googledrive.com/host/0B7u4moMmo8nDMDJuTmxSMGptUmc?ti=%u9673%u5E73%u82F1%u6587%u4E94%u4E0B_Unit1&id=1bXGGbmey3BTWtvZDdHLVwFHgEUNERXtzHSEucaBt6cs
回覆: status 301
轉成
https://079d23e82a287d32341893c3a6d0d7c6f9632316.googledrive.com/host/0B7u4moMmo8nDMDJuTmxSMGptUmc
此時掉了 query string
建立 EnglishClass.html,將課程列表放入
將 Google Drive 的目錄 share,在 share folder 內可以直接使用檔名
2014年5月14日 星期三
正式發布 英文學習站
設計過程遇到一大堆的窟窿
本想解決一個,就發佈一篇網誌
但那是不可能的
除了可能根本無法完成 英文學習站 計畫
(當然也可將網誌視為失敗紀錄)
在解決問題的過程中,一關接著一關
整個腦袋想著各種的可能
實在是分不出精神來做這事
目前只能寫寫回憶錄了
設計過程遇到一大堆的窟窿
本想解決一個,就發佈一篇網誌
但那是不可能的
除了可能根本無法完成 英文學習站 計畫
(當然也可將網誌視為失敗紀錄)
在解決問題的過程中,一關接著一關
整個腦袋想著各種的可能
實在是分不出精神來做這事
目前只能寫寫回憶錄了
- Google 發音 時靈時不靈,尤其在 Google 的 blogger,後來發現 Google Drive 內的網頁也會,本機的網頁比較不會。直覺的反應就是 Cache,所以在 chrome 的 紀錄/清除瀏覽資料 中勾選 快取圖片和檔案,解決了時靈時不靈的狀況,變成本機正常,Google 內的都不正常。
- 懷疑是 google 的 blogger 內的某一些 script 導致錯誤,所以將網頁移往 Google Drive。但還是一樣。
- 利用 chrom 內 網頁中按滑鼠右鍵,選擇 檢查元素,切換 Network 頁簽,檢查網路傳輸的差異,發現不能發音是 Status canceled,利用 chrome://net-internals ,選擇 Events,發現 正不正常 的差異是,HTTP 協議 Header 中 Referer,本機正常 沒有 Referer,Google 內的網頁不正常 都有 Referer,推測是 Google 發現 Referer 來自 Google 本身,所以回覆了404 not found。
- 本以為 ajax.setRequestHeader("Referer", ""); 能消除 Referer,發現安全性問題使得不能作用,隨後安裝 chrome 的擴充功能 Referer Control,就成功了,但是 IE 怎麼辦?之後又發現 https:// 到 http:// 也有安全性問題,不會傳送 Referer,所以將 https://translate.google.com.tw/translate_tts 改成 http://translate.google.com.tw/translate_tts 就完成了。
- 雖然 chrome 成功,IE 居然不行,虧我還是從微軟的網站上找到的資料。試試看把 audio 藏在 iframe 吧!
- 雖然 iframe 把 Referer 移除,但是裡面的 audio 移除了一半,不知為何 IE 連送三次 Request,第三次才移除 Refere_r,但還是不說話。
- 網路上有人猜測,只要有 Referer,translate_tts 就不動作,害我還懷疑是 google 的 blogger 內的某一些 script 導致錯誤,大動干戈。
- 最後放棄了,把 IE 獨立出來。
另一個問題是 Google Drive 內的網頁問題,因為一時懶惰,沒有看清說明,直接使用 share 的網址,如下 https://drive.google.com/file/d/0B7u4moMmo8nDOERrYlFDRm9NaUU 一直不成功,直到最後才發現要改成 https://googledrive.com/host/0B7u4moMmo8nDOERrYlFDRm9NaUU。
訂閱:
文章 (Atom)