網頁

顯示具有 程式語言 標籤的文章。 顯示所有文章
顯示具有 程式語言 標籤的文章。 顯示所有文章

2026年8月16日 星期日

程式語言發展(Programing Language Development)-2026

image source:Google Gemini

程式語言的發展就像是一部「如何讓人類用更自然的方式與電腦溝通」的演進史。從最早只能看懂二進位的硬體,到現在幾乎像在寫英文一樣的現代語言,這中間經歷了幾個重要階段與不同門派的演變。

Flag Counter

2025年5月4日 星期日

MAMAA 生成式 AI爭霸戰(MAMAA Generative AI Battle)-2025


image source:Google Gemini 

MAMAA 生成式 AI 大比拼:誰才是AI領域的霸主?

MAMAA,這個縮寫代表著科技巨頭 Meta(Facebook)、Apple、Microsoft、Alphabet(Google)和 Amazon。這些公司在生成式 AI 領域的競爭日益白熱化,各自擁有獨特的優勢和發展方向。

Free counters!

2024年3月17日 星期日

Javascript倒數計時器(Javascript Final Countdown Counter)-2024

 <html>  

<head>  

<meta charset=" utf-8">  

<meta name="author" content="Snova" />  

<title>倒數計時</title>  

<script type="text/javascript">  

window.onload=function(){

  var timer=null;

  var show=document.getElementById("show");

  function show_date_time(){   

    var target=new Date("9999/12/31");  

    var today=new Date(); 

    var timeold=(target.getTime()-today.getTime());   

    var sectimeold=timeold/1000   

    var secondsold=Math.floor(sectimeold);   

    var msPerDay=24*60*60*1000   

    var e_daysold=timeold/msPerDay   

    var daysold=Math.floor(e_daysold);   

    var e_hrsold=(e_daysold-daysold)*24;   

    var hrsold=Math.floor(e_hrsold);   

    var e_minsold=(e_hrsold-hrsold)*60;   

    var minsold=Math.floor((e_hrsold-hrsold)*60);   

    var seconds=Math.floor((e_minsold-minsold)*60);

    if(daysold<0){   

      document.getElementById("time").innerHTML="逾期,倒數計時已經失效";  

      clearInterval(timer);

    }   

    else{   

      if (daysold<10) {daysold="0"+daysold}   

      if (hrsold<10) {hrsold="0"+hrsold}   

      if (minsold<10) {minsold="0"+minsold}   

      if (seconds<10) {seconds="0"+seconds}     

      show.innerHTML="距離9999/12/31還有:"+daysold+"天"+hrsold+"小時"+minsold+"分"+seconds+"秒";     

    }   

  }   

  timer=setInterval(show_date_time,1000);

}  

</script>

</head> 

<body> 

<div id="show"></div>

</body> 

</html>

Flag Counter

2024年3月10日 星期日

Javascript萬年曆(Javascript Calendar)-2024

 <html>

<style type='text/css'>

.cal     {border-collapse:collapse}

.cal TH  {background:green;

          border:solid 1px green;

          text-align:center

         }

.cal TD  {border:solid 1px green;

          text-align:right

         }

.cal COL {background:pink}

</style>

<div id=calendar></div>

<script type='text/javascript'>

function drawCal(inc)

{

  month+=inc;

  if(month == 0 )

  {

    month=12;

    year--;

  }

  else if( month == 13 )

       {

         month=1;

         year++;

       }

  calendar(year, month);

}

function calendar(yr, mth)

{

  var td=new Date();

  var today=new Date( td.getFullYear(), td.getMonth(), td.getDate());

  var s='<table class=cal><col>';

  s+='<tr><th onclick="drawCal(-1)"><<<th colspan=5>'

      +yr +'.'+ mth +'<th onclick="drawCal(1)">>>';

  mth--;

  s+='<tr><th>S<th>M<th>T<th>W<th>T<th>F<th>S';

  var dt=new Date(yr, mth, 1);

  var wd=dt.getDay(); //week day

  var i;

  s+='<tr>';

  for( ; wd > 0 ; wd--)   s+='<td>';

  for( i=1; i<32; )

  {

    dt=new Date(yr, mth, i);

    if( dt.toString() == today.toString() )

      s+='<td style="color:blue; font-weight:bolder">'+i;

    else

      s+='<td>'+i;

    dt=new Date(yr, mth, ++i);

    if( dt.getMonth() != mth ) break;

    wd=dt.getDay();

    if( wd == 0 )

      s+='<tr>';

  }

  for( ; wd < 6; wd++)  s+='<td>';

  s+='</table>';

  document.getElementById('calendar').innerHTML=s;

}

var td=new Date();

var year=td.getFullYear();

var month=td.getMonth()+1;

calendar(year, month);

</script>

</html>

Flag Counter

2018年8月19日 星期日

JavaScript大樂透(Javascript Lottery Number)

以下的程式碼可以在HTML產生大樂透的號碼:
<html>
<head>
<title>Lottery Number</title>
</head>
<script type="text/javascript"> 
lotnum = new Array(); 
var t;
for (t=1; t<=49; t++)
{
lotnum[t-1] = t;
}
lotnum.sort( function(){ return Math.round( Math.random() ) - 0.5 ; } ); 
var counter;
for (counter=0; counter<=5; counter++)
{
document.write("號碼"+counter+":"+lotnum[counter]+"</br>");
}
document.write("特別號"+":"+lotnum[6]+"</br>");
</script>
</html>
Flag Counter

2018年2月4日 星期日

HTML 5 地理位置API(HTML 5 Geolocation API)

利用以下HTML 5程式碼可取得你目前所在的地理位置,不過前提是瀏覽器必須要支援以下的語法,比較舊型的瀏覽器已經無法支援HTML 5語法。
<!DOCTYPE html>
<meta charset=utf-8>
<head>
  <title>HTML5 Geolocation API</title>
  <script>
    function $i(id) {return document.getElementById(id);}
  </script>
</head>
<body>
  <table style="border: solid 1px red;">
    <thead>
<tr><th>Attribute</th><th>Value</th><th>Unit</th>
    </tr>
</thead>
    <tbody>
<tr>
        <td>Latitude</td>
        <td id="latitude"></td>
        <td>degree</td>
      </tr>
<tr>
        <td>Longitude</td>
        <td id="longitude"></td>
        <td>degree</td>
      </tr>
<tr>
        <td>Altitude</td>
        <td id="altitude"></td>
        <td>m</td>
      </tr>
<tr>
        <td>Accuracy</td>
        <td id="accuracy"></td>
        <td>m</td>
      </tr>
<tr>
        <td>Altitude Accuracy</td>
        <td id="altitudeAccuracy"></td>
        <td>m</td>
      </tr>
<tr>
        <td>Heading</td>
        <td id="heading"></td>
        <td>degree/s</td>
      </tr>
<tr>
        <td>Speed</td>
        <td id="speed"></td>
        <td>m/s</td>
      </tr>
<tr>
        <td>Timestamp</td>
        <td id="timestamp"></td>
        <td>ms</td>
      </tr>
</tbody>
  </table>
<script>
    if (navigator.geolocation) {
        var geo=navigator.geolocation;
        var option={
              enableAcuracy:false,
              maximumAge:0,
              timeout:60000
              };
        geo.getCurrentPosition(successCallback,
                               errorCallback,
                               option
                               );
        }
    else {alert("This browser doesn't support geolocation function!");}
    function successCallback(position) {
      $i("latitude").innerHTML=position.coords.latitude;
      $i("longitude").innerHTML=position.coords.longitude;
      $i("altitude").innerHTML=position.coords.altitude;
      $i("accuracy").innerHTML=position.coords.accuracy;
      $i("altitudeAccuracy").innerHTML=position.coords.altitudeAccuracy;
      $i("heading").innerHTML=position.coords.heading;
      $i("speed").innerHTML=position.coords.speed;
      $i("timestamp").innerHTML=position.timestamp;
      }
    function errorCallback(error) {
      var errorTypes={
            0:"Unknown Error",
            1:"Permisson Denied",
            2:"Position Unavailable",
            3:"Timeout"
            };
      alert(errorTypes[error.code]);
      alert("code=" + error.code + " " + error.message);
      }
  </script>
</body>

或者 errorCallback(error)也可以改寫成
    function errorCallback(error) {
      var error=0;
      switch (error) {
              case 0:   
              alert(error);
              alert("code=" + error.code + " " + "Unknown Error");
              break;
              case 1:   
              alert(error);
              alert("code=" + error.code + " " + "Permisson Denied");
              break;
              case 2:   
              alert(error);
              alert("code=" + error.code + " " + "Position Unavailable");
              break;
              case 3:   
              alert(error);
              alert("code=" + error.code + " " + "Timeout");
              break;
              default:
              alert(error);
              alert("code=" + error.code + " " + "Unknown Error");
              break;
            };
      }


Flag Counter

2017年11月5日 星期日

如何在blogger與網頁顯示現在日期與時間(How to show present date & time in blogger and webpage?)

程式碼如下:
The current date & time is:<br />
<script>
var display=setInterval(function(){Time()},0);
<p id="currentdate"></p>
<p id="currenttime"></p>
<p id="currentdatetime"></p>
function Time()
{
var date=new Date();
var time=date.toLocaleTimeString();
var date1=date.toLocaleDateString();
document.getElementById("currentdate").innerHTML=date1;
document.getElementById("currenttime").innerHTML=time;
document.getElementById("currentdatetime").innerHTML=date;
}
</script>

2016年1月7日 星期四

隱私權(Privacy)

Information we get from your use of our services.We collect information about the services that you use and how you use them, like when you watch a video on YouTube, visit a website that uses our advertising services, or view and interact with our ads and content. This information includes:
  • Device information
    We collect device-specific information(such as your hardware model, operating system version,unique device identifiers, and mobile network information including phone number). our may associate your device identifiers or phone number with your our Account.
  • Log information
    When you use our services or view content provided by our, we automatically collect and store certain information in server logs. This includes:
    • details of how you used our service, such as your search queries.
    • telephony log information like your phone number, calling-party number, forwarding numbers, time and date of calls, duration of calls, SMS routing information and types of calls.
    • Internet protocol address.
    • device event information such as crashes, system activity, hardware settings, browser type, browser language, the date and time of your request and referral URL.
    • cookies that may uniquely identify your browser or your our Account.
  • Location information
    When you use our services, we may collect and process information about your actual location. We use various technologies to determine location, including IP address, GPS,and other sensors that may, for example, provide our with information on nearby devices,Wi-Fi access points and cell towers.
  • Unique application numbers
    Certain services include a unique application number. This number and information about your installation (for example, the operating system type and application version number) may be sent to our when you install or uninstall that service or when that service periodically contacts our servers, such as for automatic updates.
  • Local storage
    We may collect and store information (including personal information) locally on your device using mechanisms such as browser web storage(including HTML5) and application data caches.
  • Cookies and similar technologies
    We and our partners use various technologies to collect and store information when you visit a our service, and this may include using cookies or similar technologies to identify your browser or device. We also use these technologies to collect and store information when you interact with services we offer to our partners, such as advertising services or our features that may appear on other sites. Our our Analytics product helps businesses and site owners analyze the traffic to their websites and apps. When used in conjunction with our advertising services, such as those using the DoubleClick cookie, our Analytics information is linked, by the our Analytics customer or by our, using our technology, with information about visits to multiple sites.


2015年4月19日 星期日

Android學習心得-多國語言資料夾的設定(Android Study Review- Setting Multi-language Folders)

在每個專案的res目錄下建立不同名稱的values文件以顯示不同的語言,這裡寫的是沒有經過變更硬體或軟體架構的android系統的設定方式,如果使用的行動裝置有更改過android原始設訂的則不一定會依據這種方式變更。
預設values資料夾最好用英文,因此在沒有加入其他多國語言資料夾預設值的語言為英文的話理論上應該是全部的手機都會支援英文,假設沒有加入韓文資料夾或者相關的字串翻譯的話(資料夾中的strings.xml必須做對應變更,而且字串代值必須用r.strings.text來加入Activity或在layout的xml加入text=@string/text指令,text就是字串的替代對應值),用韓文版的android手機使用這個app就僅會顯示英文。
舉常用的Toast指令為例:
Toast.makeText(this,"這是一個Toast",Toast.LENGTH_LONG).show();
在不同手機下就只會秀 這是一個Toast的訊息或者亂碼或是空白字元,就要看手機有無裝繁體字形。
而依據底下的指令才可能依據不同語言秀出不同的文字,而且每個語言的strings.xml中text的值也要跟著變化,
Toast.makeText(this,R.string.text,Toast.LENGTH_SHORT).show();
Free counters!