❶ 我想學習編程,但是不知道該怎麼開始。
我建議最好是從基礎入手,而不是一開始就進行可視化編程。雖然如今國內絕大多數pc都是使用的windows,但是畢竟這知識這個世界的冰山一角。扎實的基礎自然會更有用處。編程其實重要的是程序思維,然後是演算法和數據結構。這些都是超出語言的,就是說不管是學c學java學delphi還是別的什麼,這一部分都是一致的。因此培養這部分的知識可以說是一本萬利的事情。初學肯定是通過語言熟悉思想熟悉演算法和數據結構,到一定的時候就是純粹的思想和演算法數據結構的學習,便已經脫離程序語言了。經歷過這些階段,換一種語言不過是重新了解一下描述的方式,就像你了解了中文思維,山東話和四川話的差別就不會太大;了解了拉丁語的思維,整個語系的語言都不過是簡簡單單的記憶工作,應用就好。入門的語言,理論上是怎麼方便學哪個,看那個順眼學哪個。當然這裡面還是有不同的推薦的。一般來說我比較推薦pascal、c/c++、java。並不是因為這三個東西很通用很有前途,而是它們實在是嚴整而有規則(c/c++還顯得稍微的寬鬆了一點),而嚴謹的語法要求和明確的概念區分是有利於編程思維的形成和演算法數據結構的學習的。同樣的因為這個理由我不推薦vb,而並不是因為它功能不強大(事實上vb在windows環境中是相當牛的語言)另外一個建議是,如果學c,不要一開始就用vc。ms提供的很多東西很方便,有很多很簡單的實現方法,但是它們不標准。vc與ansi
c標準是有很大的差距的。首先一個不遵循標準的c/c++程序是不通用的,換個編譯器說不定就不被承認了。所以我非常推崇gcc,理由之一是它完全符合
ansi
c標准,無論它的c還是c++編譯器都很嚴整,功能上一點也不缺乏(有人說gcc不能做圖形界面的程序,這一點完全錯誤,到處都有的qt庫和gtk庫都能做出很好的界面),另外一個理由便是它免費,畢竟稍微大一點的軟體企業就不會屈從與微軟的編譯器和平台,而一個免費的c編譯器無疑可以創造更多的利益;就算要轉vc,標準的c程序也是幾乎不要作任何改動的。當然,這一切的前提是,你真的很想很好的學編程,做一個這方面的精英。如果只不過是興趣,或者只是想拿一個ms的工程師認證然後在國內企業找份諸如設計vf、vb程序之類的工作,那完全可以忽略我上面的話,去找個認證培訓班,認認真真聽聽課,好好完成練習,從vb或者vc入手,考好認證是很不會太難的。畢竟現在很多很好的大學里都從來不缺乏計算機的課程,不會缺少演算法或者編譯原理的課程,不會沒有計算機科學的研究院,而那裡面出來的人一般都具備了很好的基礎知識,會更加容易成為前面所說的精英。
❷ 我現在需要一個二級聯動城市的下拉菜單asp源代碼,同志們幫幫忙啊!
<SCRIPT LANGUAGE="JavaScript">
function Dsy()
{
this.Items = {};
}
Dsy.prototype.add = function(id,iArray)
{
this.Items[id] = iArray;
}
Dsy.prototype.Exists = function(id)
{
if(typeof(this.Items[id]) == "undefined") return false;
return true;
}
function change(v){
var str="0";
for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
var ss=document.getElementById(s[v]);
with(ss){
length = 0;
options[0]=new Option(opt0[v],opt0[v]);
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str];
for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]);
if(v)options[1].selected = true;
}
}
if(++v<s.length){change(v);}
}
}
var dsy = new Dsy();
dsy.add("0",["北京市","天津市","河北省","山西省","內蒙古","遼寧省","吉林省","黑龍江省","上海市","江蘇省","浙江省","安徽省","福建省","江西省","山東省","河南省","湖北省","湖南省","廣東省","廣西自治區","海南省","重慶市","四川省","貴州省","雲南省","西藏自治區","陝西省","甘肅省","青海省","寧夏回族自治區","新疆維吾爾自治區","香港特別行政區","澳門特別行政區","台灣省","其它"]);
dsy.add("0_0",["北京","東城區","西城區","崇文區","宣武區","朝陽區","豐台區","石景山區"," 海淀區(中關村)","門頭溝區","房山區","通州區","順義區","昌平區","大興區","懷柔區","平谷區","密雲縣","延慶縣","其他"]);
dsy.add("0_1",["和平區","河東區","河西區","南開區","紅橋區","塘沽區","漢沽區","大港區","西青區","津南區","武清區","薊縣","寧河縣","靜海縣","其他"]);
dsy.add("0_2",["石家莊市","張家口市","承德市","秦皇島市","唐山市","廊坊市","衡水市","滄州市","邢台市","邯鄲市","保定市","其他"]);
dsy.add("0_3",["太原市","朔州市","大同市","長治市","晉城市","忻州市","晉中市","臨汾市","呂梁市","運城市","其他"]);
dsy.add("0_4",["呼和浩特市","包頭市","赤峰市","呼倫貝爾市","鄂爾多斯市","烏蘭察布市","巴彥淖爾市","興安盟","阿拉善盟","錫林郭勒盟","其他"]);
dsy.add("0_5",["沈陽市","朝陽市","阜新市","鐵嶺市","撫順市","丹東市","本溪市","遼陽市","鞍山市","大連市","營口市","盤錦市","錦州市","葫蘆島市","其他"]);
dsy.add("0_6",["長春市","白城市","吉林市","四平市","遼源市","通化市","白山市","延邊朝鮮族自治州","其他"]);
dsy.add("0_7",["哈爾濱市","七台河市","黑河市","大慶市","齊齊哈爾市","伊春市","佳木斯市","雙鴨山市","雞西市","大興安嶺地區(加格達奇)","牡丹江","鶴崗市","綏化市 ","其他"]);
dsy.add("0_8",["黃浦區","盧灣區","徐匯區","長寧區","靜安區","普陀區","閘北區","虹口區","楊浦區","閔行區","寶山區","嘉定區","浦東新區","金山區","松江區","青浦區","南匯區","奉賢區","崇明縣","其他"]);
dsy.add("0_9",["南京市","徐州市","連雲港市","宿遷市","淮安市","鹽城市","揚州市","泰州市","南通市","鎮江市","常州市","無錫市","蘇州市","其他"]);
dsy.add("0_10",["杭州市","湖州市","嘉興市","舟山市","寧波市","紹興市","衢州市","金華市","台州市","溫州市","麗水市","其他"]);
dsy.add("0_11",["合肥市","宿州市","淮北市","亳州市","阜陽市","蚌埠市","淮南市","滁州市","馬鞍山市","蕪湖市","銅陵市","安慶市","黃山市","六安市","巢湖市","池州市","宣城市","其他"]);
dsy.add("0_12",["福州市","南平市","莆田市","三明市","泉州市","廈門市","漳州市","龍岩市","寧德市","其他"]);
dsy.add("0_13",["南昌市","九江市","景德鎮市","鷹潭市","新余市","萍鄉市","贛州市","上饒市","撫州市","宜春市","吉安市","其他"]);
dsy.add("0_14",["濟南市","聊城市","德州市","東營市","淄博市","濰坊市","煙台市","威海市","青島市","日照市","臨沂市","棗庄市","濟寧市","泰安市","萊蕪市","濱州市","菏澤市","其他"]);
dsy.add("0_15",["鄭州市","三門峽市","洛陽市","焦作市","新鄉市","鶴壁市","安陽市","濮陽市","開封市","商丘市","許昌市","漯河市","平頂山市","南陽市","信陽市","周口市","駐馬店市","其他"]);
dsy.add("0_16",["武漢市","十堰市","襄樊市","荊門市","孝感市","黃岡市","鄂州市","黃石市","咸寧市","荊州市","宜昌市","隨州市","恩施土家族苗族自治州","仙桃市","天門市","潛江市","神農架林區","其他"]);
dsy.add("0_17",["長沙市","張家界市","常德市","益陽市","岳陽市","株洲市","湘潭市","衡陽市","郴州市","永州市","邵陽市","懷化市","婁底市","湘西土家族苗族自治州","其他"]);
dsy.add("0_18",["廣州市","清遠市市","韶關市","河源市","梅州市","潮州市","汕頭市","揭陽市","汕尾市","惠州市","東莞市","深圳市","珠海市","中山市","江門市","佛山市","肇慶市","雲浮市","陽江市","茂名市","湛江市","其他"]);
dsy.add("0_19",["南寧市","桂林市","柳州市","梧州市","貴港市","玉林市","欽州市","北海市","防城港市","崇左市","百色市","河池市","來賓市","賀州市","其他"]);
dsy.add("0_20",["海口市","三亞市","其他"]);
dsy.add("0_21",["渝中區","大渡口區","江北區","沙坪壩區","九龍坡區","南岸區","北碚區","萬盛區","雙橋區","渝北區","巴南區","萬州區","涪陵區","黔江區","長壽區","合川市","永川市","江津市","南川市","綦江縣","潼南縣","銅梁縣","大足縣","璧山縣","墊江縣","武隆縣","豐都縣","城口縣","開縣","巫溪縣","巫山縣","奉節縣","雲陽縣","忠縣","石柱土家族自治縣","彭水苗族土家族自治縣","酉陽土家族苗族自治縣","秀山土家族苗族自治縣","其他"]);
dsy.add("0_22",["成都市","廣元市","綿陽市","德陽市","南充市","廣安市","遂寧市","內江市","樂山市","自貢市","瀘州市","宜賓市","攀枝花市","巴中市","資陽市","眉山市","雅安","阿壩藏族羌族自治州","甘孜藏族自治州","涼山彝族自治州縣","其他"]);
dsy.add("0_23",["貴陽市","六盤水市","遵義市","安順市","畢節地區","銅仁地區","黔東南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","其他"]);
dsy.add("0_24",["昆明市","曲靖市","玉溪市","保山市","昭通市","麗江市","普洱市","臨滄市","寧德市","德宏傣族景頗族自治州","怒江僳僳族自治州","楚雄彝族自治州","紅河哈尼族彝族自治州","文山壯族苗族自治州","大理白族自治州","迪慶藏族自治州","西雙版納傣族自治州","其他"]);
dsy.add("0_25",["拉薩市","那曲地區","昌都地區","林芝地區","山南地區","日喀則地區","阿里地區","其他"]);
dsy.add("0_26",["西安市","延安市","銅川市","渭南市","咸陽市","寶雞市","漢中市","安康市","商洛市","其他"]);
dsy.add("0_27",["蘭州市 ","嘉峪關市","金昌市","白銀市","天水市","武威市","酒泉市","張掖市","慶陽市","平涼市","定西市","隴南市","臨夏回族自治州","甘南藏族自治州","其他"]);
dsy.add("0_28",["西寧市","海東地區","海北藏族自治州","黃南藏族自治州","玉樹藏族自治州","海南藏族自治州","果洛藏族自治州","海西蒙古族藏族自治州","其他"]);
dsy.add("0_29",["銀川市","石嘴山市","吳忠市","固原市","中衛市","其他"]);
dsy.add("0_30",["烏魯木齊市","克拉瑪依市","喀什地區","阿克蘇地區","和田地區","吐魯番地區","哈密地區","塔城地區","阿勒泰地區","克孜勒蘇柯爾克孜自治州","博爾塔拉蒙古自治州","昌吉回族自治州 伊犁哈薩克自治州","巴音郭楞蒙古自治州","河子市","阿拉爾市","五家渠市","圖木舒克市","其他"]);
dsy.add("0_31",["香港","其他"]);
dsy.add("0_31",["澳門","其他"])
dsy.add("0_32",["台灣","其他"])
//-->
</SCRIPT>
<SCRIPT LANGUAGE = JavaScript>
var s=["s1","s2"];
var opt0 = ["請選擇","請選擇"];
function setup()
{
for(i=0;i<s.length-1;i++)
document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
change(0);
}
</SCRIPT>
調用:<select name="lz_sf" id="s1">
<option></option></select>
<select name="lz_sx" id="s2">
<option></option></select>
<SCRIPT language="javascript">
setup()
</SCRIPT>
❸ 請問如何實現:在網頁中選擇了國家,下面自動出現該國家的省名供選擇
<script type="text/javascript">
//定義了城市的二維數組,裡面的順序跟省份的順序是相同的。通過selectedIndex獲得省份的下標值來得到相應的城市數組
var city=[
["北京","天津","上海","重慶","香港","澳門"],
["石家莊","唐山","秦皇島","邯鄲","邢台","保定","張家口","承德","滄州","廊坊","衡水"],
["太原","大同","陽泉","長治","晉城","朔州","晉中","運城","忻州","臨汾","呂梁"],
["呼和浩特","包頭","烏海","赤峰","通遼","鄂爾多斯","呼倫貝爾","巴彥淖爾","烏蘭察布","興安","錫林郭勒","阿拉善"],
["沈陽","大連","鞍山","撫順","本溪","丹東","錦州","營口","阜新","遼陽","盤錦","鐵嶺","朝陽","葫蘆島"],
["長春","吉林","四平","遼源","通化","白山","松原","白城","延邊"],
["哈爾濱","齊齊哈爾","雞西","鶴崗","雙鴨山","大慶","伊春","佳木斯","七台河","牡丹江","黑河","綏化","大興安嶺"],
["南京","蘇州","揚州","無錫","徐州","常州","南通","連雲港","淮安","鹽城","鎮江","泰州","宿遷"],
["杭州","寧波","溫州","嘉興","湖州","紹興","金華","衢州","舟山","台州","麗水"],
["合肥","蕪湖","蚌埠","淮南","馬鞍山","淮北","銅陵","安慶","黃山","滁州","阜陽","宿州","巢湖","六安","亳州","池州","宣城"],
["福州","寧德","南平","廈門","莆田","三明","泉州","漳州"],
["南昌","上饒","萍鄉","九江","景德鎮","新余","鷹潭","贛州","吉安","宜春","撫州"],
["濟南","青島","淄博","棗庄","東營","煙台","濰坊","威海","濟寧","泰安","日照","萊蕪","臨沂","德州","聊城","濱州","菏澤"],
["鄭州","開封","洛陽","平頂山","焦作","鶴壁","新鄉","安陽","濮陽","漯河","許昌","三門峽","南陽","商丘","信陽","周口","駐馬店"],
["武漢","十堰","襄樊","鄂州","黃石","荊州","宜昌","荊門","孝感","黃岡","咸寧","隨州","恩施"],
["長沙","株洲","湘潭","岳陽","邵陽","常德","衡陽","張家界","益陽","郴州","永州","懷化","婁底","湘西"],
["廣州","清遠","潮州","東莞","珠海","深圳","汕頭","韶關","佛山","江門","湛江","茂名","肇慶","惠州","梅州","汕尾","陽江","河源","中山","揭陽","雲浮"],
["南寧","柳州","桂林","梧州","北海","防城港","欽州","貴港","玉林","百色","賀州","河池","來賓","崇左"],
["海口","三亞"],
["成都","自貢","攀枝花","瀘州","德陽","綿陽","廣元","遂寧","內江","樂山","南充","宜賓","廣安","達州","眉山","雅安","巴中","資陽","阿壩","甘孜","涼山"],
["貴陽","六盤水","遵義","安順","銅仁","畢節","黔西南","黔東南","黔南"],
["昆明","曲靖","玉溪","保山","昭通","麗江","普洱","臨滄","文山","紅河","西雙版納","楚雄","大理","德宏","怒江","迪慶"],
["拉薩","昌都","山南","日喀則","那曲","阿里","林芝"],
["西安","銅川","寶雞","咸陽","渭南","延安","漢中","榆林","安康","商洛"],
["蘭州","白銀","定西","敦煌","嘉峪關","金昌","天水","武威","張掖","平涼","酒泉","慶陽","臨夏","隴南","甘南"],
["西寧","海東","海北","黃南","海南","果洛","玉樹","海西"],
["銀川","石嘴山","吳忠","固原","中衛"],
["烏魯木齊","克拉瑪依","吐魯番","哈密","和田","阿克蘇","喀什","克孜勒蘇柯爾克孜","巴音郭楞蒙古","昌吉","博爾塔拉蒙古","伊犁哈薩克","阿勒泰"],
["台北","高雄","基隆","台中","台南","新竹","嘉義"]
];
function getCity(){
//獲得省份下拉框的對象
var sltProvince=document.forms[0].province;
//獲得城市下拉框的對象
var sltCity=document.forms[0].city;
//得到對應省份的城市數組
var provinceCity=city[sltProvince.selectedIndex - 1];
//清空城市下拉框,僅留提示選項
sltCity.length=1;
//將城市數組中的值填充到城市下拉框中
for(var i=0;i<provinceCity.length;i++){
sltCity[i+1]=new Option(provinceCity[i],provinceCity[i]);
}
}
</script>
<form action="#" method="POST" name="myform" target="_self" id="myform">
<select name="province" onChange="getCity()">
<option value="null" disabled="disabled">請選擇所在省份</option>
<option value="直轄市">直轄市</option>
<option value="河北">河北</option>
<option value="山西">山西</option>
<option value="內蒙古">內蒙古</option>
<option value="遼寧">遼寧</option>
<option value="吉林">吉林</option>
<option value="黑龍江">黑龍江</option>
<option value="江蘇">江蘇</option>
<option value="浙江">浙江</option>
<option value="安徽">安徽 </option>
<option value="福建">福建 </option>
<option value="江西">江西</option>
<option value="山東">山東</option>
<option value="河南">河南</option>
<option value="湖北">湖北</option>
<option value="湖南">湖南</option>
<option value="廣東">廣東</option>
<option value="廣西">廣西</option>
<option value="海南">海南</option>
<option value="四川">四川</option>
<option value="貴州">貴州</option>
<option value="雲南">雲南</option>
<option value="西藏">西藏</option>
<option value="陝西">陝西 </option>
<option value="甘肅">甘肅 </option>
<option value="青海">青海</option>
<option value="寧夏">寧夏</option>
<option value="新疆">新疆</option>
<option value="台灣">台灣</option>
</select>
<select name="city">
<option selected="selected" value="null">請選擇所在城市</option>
</select>
</form> 直接用就可以了。這是 省市 2級聯動
❹ 想要搭建一款穩定的直播平台,直播源碼怎麼安裝啊
一、搭建直播平台源碼,移動直播推流端
直播推流端即主播端,主要通過手機攝像頭採集視頻數據和麥克風採集音頻數據,經過一系列前處理、編碼、封裝,然後推流到CDN進行分發。
1、採集
移動直播SDK通過手機攝像頭和麥克風直接採集音視頻數據。其中,IOS硬體種類不多,所以比較簡單,安卓則由於市面上硬體機型非常多,所以難以做到一個庫適配所有硬體。
2、前處理
在這個環節主要處理美顏、水印、模糊等效果。美顏功能幾乎是直播的標配功能。我們調研中發現太多case是因為沒有美顏功能被拋棄使用的。另外國家明確提出了,所有直播都必須打有水印並回放留存15天以上。
3、編碼
為了便於手機視頻的推流、拉流以及存儲,通常採用視頻編碼壓縮技術來減少視頻的體積,現在比較常用的視頻編碼是H.264。在音頻方面,比較常用的是AAC編碼格式,其它如MP3、WMA也是可選方案。
4、推流
要想用於推流還必須把音視頻數據使用傳輸協議進行封裝,變成流數據。常用的流傳輸協議有RTSP、RTMP、HLS等,使用RTMP傳輸的延時通常在1–3秒,對於移動直播這種實時性要求非常高的場景,RTMP也成為移動直播中最常用的流傳輸協議。最後通過一定的Qos演算法將音視頻流數據推送到網路斷,通過CDN進行分發。
二、搭建直播平台源碼,服務端處理
為了讓推上來的流適配各終端各種不同協議,服務端還需要對流進行轉碼,包括截圖、錄制、水印等。
三、搭建直播平台源碼,播放器端
1、拉流
拉流實際是推流的逆過程。首先通過播放端獲取碼流,標準的拉流格式有RTMP、HLS、FLV等。RTMP是Adobe的專利協議,開源軟體和開源庫都支持的比較好,如開源的librtmp庫,播放端只要支持flashPlayer的就能非常簡單的播放RTMP直播,直播延遲一般在1–3秒。
1、解碼和渲染
是指從音視頻的數據中提取原始數據,也即音視頻的播放。前面介紹的H.264和H.265編碼格式都是有損壓縮,所以在提取後的原始數據,並非原始采樣數據,存在一定的信息丟失。因此,在視頻體積最小的情況下通過各種編碼參數保留最好的原始畫面,成為了各視頻公司的核心機密。
總之,搭建一套直播系統還是很復雜的,大部分運營級的直播系統,是直接找專業的開發團隊進行項目開發、系統測試和最終的上線部署,一整套開發到上架,最後還需要有專門的技術維護團隊進行運營過程中的技術問題處理。我之前在山東布穀直播開發了一套直播程序,有售後保障,你可以咨詢問問。