最近在點部落參加Silverlight試煉大會,所以文章主要都發在那邊,有興趣的可以去看看:
http://www.dotblogs.com.tw/lolota/
[Silverlight]Hello Siverlight ----- Day 1
[Silverlight]動態讀取圖片以及影片 ----- Day4
[Silverlight]客製化你的Loading Bar -----Day5
其他的可以看這裡
....待續....
最近在點部落參加Silverlight試煉大會,所以文章主要都發在那邊,有興趣的可以去看看:
http://www.dotblogs.com.tw/lolota/
[Silverlight]Hello Siverlight ----- Day 1
[Silverlight]動態讀取圖片以及影片 ----- Day4
[Silverlight]客製化你的Loading Bar -----Day5
其他的可以看這裡
....待續....
今天早上要複習一下ASP.NET ToolKit時,發現在Visual Studio無法直接從ToolBox拖拉ToolKit控制
項到畫面中,會出現「The operation could not be completed. 無效的 FORMATETC 結構」,這
個錯誤訊息是第一次看到,但是這種事在Visual Studio遇到多次已經見怪不怪了,檢查了一下
Web.config,因為是新開的網頁專案,因此是不會有多大問題,然後上網Google了一下,原來是移動
了AjaxControlToolkit.dll的位置,導致ToolBox對應不到這個dll,然後出現了這個很不對題的錯誤訊
息。在reset ToolBox後,打算在工具箱加入AjaxControlToolkit.dll,在選擇了Choose Items這個選
項後,Visual Studio 2K8 就直接關閉,然後重開,這.....好吧, 看來命運之神就是不讓我溫習一下就
是了,再度上網找谷哥神...OK,可能是PowerCommand的問題,移除這個Plug-in後,重新加入dll,
嗯嗯....搞定收工!!
在SQL Server中,我們要取得某些條件的前幾筆,可以透過TOP n去取得:
Select Top 1 * from Table1 Where ID = '9527'
SELECT * FROM
(
SELECT *
FROM Table1
WHERE (ID = '9527')
)
WHERE (ROWNUM < 2)
現在很多東西都講求搖一搖才有效,在過去有泡沫紅茶,[雪克]系列(這個不知道大家還有沒有印象?)
前一陣子,SE手機也推出了搖一搖就換歌的[雞肋]功能,現在,WIndows 7也要來湊一腳..Orz
我得老實說,這功能跟Windows Vista內的Aero換視窗一樣,應該會被我關掉吧.
除非它可以幫我搖出新一期樂透號碼...
(Credit: Adrian Pingstone)
Google 的機場將迎來一位新伙伴 -- 一架 Dornier Alpha Jet 輕戰鬥機/噴射訓練機。為什麼 Google 要買戰鬥機,這歷史要從去年說起。Google 去年和 NASA 達成協議,讓 Google 使用位於 Google 總部隔壁的 Moffett Field 軍用機場,做為 Google 機隊的停放地,條件則是 Google 要提供旗下的飛機給 NASA 做為科學研究之用。但後來 Google 發現這個安排有一點小麻煩 -- Google 旗下的飛機都是客機,每次為了實驗做改裝,都要向 FAA(美國的航管局)申請、認證,實在是麻煩的要死,所以 Google 乾脆就買了架噴射機,專門給 NASA 實驗用(或是讓 Schmidt 沒事飛著玩?)。
據信目前 Google 尚未有轟炸微軟總部的計畫。
引用來源:
http://chinese.engadget.com/2008/11/07/google-buys-fighter-jet/
http://bits.blogs.nytimes.com/2008/10/23/a-new-fighter-jet-for-googles-founders/
攻擊模式似疾風病毒 台灣微軟呼籲使用者盡速下載 MS08-067 安全更新
新一代作業系統 Windows Vista、Windows Server 2008 影響較小
(2008 年 10 月 24 日,台北) 台灣微軟公司今日緊急發佈重大資訊安全公告 MS08-067,解決目前所有支援的 Windows 作業系統版本 server 服務中所存在可能會允許遠端執行程式碼的弱點。目前尚未有利用該漏洞的攻擊行為出現,但這個弱點可能被用來蓄意製作可包含蠕蟲的要求,攻擊模式類似當年造成重大災害的疾風病毒 (Blaster)。台灣微軟預估本周末與下周將會是攻擊發起的重要關鍵時刻,特別呼籲所有使用者,盡速進行安全更新,以降低資安風險。
台灣微軟已經發現在網路上流傳驗證此攻擊路徑的程式碼,並偵測到駭客對該漏洞的驗證攻擊程式碼密集流傳中。根據攻擊程式碼的流傳狀況,台灣微軟預估本週末與下週將會是攻擊發起的重要關鍵時刻,因此呼籲所有使用者應儘速察看設備的更新情形,並保持在最新更新狀態。
此漏洞會影響所有 Windows 作業系統,在 Windows XP 或較早期作業系統的資訊安全等級裡定義為「重大(Critical)」;但對於新一代的作業系統 Windows Vista、Windows Server 2008 與較新的作業系統版本影響較小,等級定義為「重要(Important)」,試圖透過該漏洞入侵的攻擊者,只有在通過身份驗證程序後,才會觸發該漏洞造成危害。台灣微軟建議所有使用者應盡速至以下網址下載更新程式:http://www.microsoft.com/taiwan/technet/security/bulletin/ms08-067.mspx。
截至目前為止,尚未有出現攻擊該漏洞的案例,倘若未來出現相關事件,台灣微軟也將會主動在免費病毒移除工具 MSRT(Malicious Software Removal Tool)中,納入相關病毒碼。
此漏洞的攻擊模式為:攻擊者會試圖植入一個惡意程式到受害者的電腦上,竊取使用者的資訊如:使用者名稱、IP位址、最近開啟過的檔案等等,且會讓電腦的速度越來越慢,終致當機。而該惡意程式目前已知有兩種不同版本。微軟的產品能夠偵測這兩種不同版本,並標記為「TrojanSpy:Win32/Gimmiv.A」。同時,此惡意程式也會留下一個 DLL 檔案,亦標記為「TrojanSpy:Win32/Gimmiv.A」。該惡意程式會在執行後自動刪除,因此使用者較難在系統受到影響之後,自行尋找相關歷史痕跡。
台灣微軟在發現該漏洞內容之後,有鑑於其危害之嚴重性,為了維護使用者的安全起見,便立即發佈相關更新程式,在使用該漏洞的攻擊程式出現之前,提早解決相關安全性問題。
除了發佈作業系統更新程式之外,台灣微軟也已經在微軟惡意程式保護中心(Malware Protection Center)中,發佈可供 Microsoft Forefront與Microsoft OneCare 使用的惡意程式碼更新,該更新可以保護試圖入侵該漏洞的攻擊(Exploit:Win32/MS08067.gen!A)。同時也將相關攻擊特徵藉由 Microsoft Active Protections Program 與 Microsoft Security Response Alliance Program 等管道,告知與微軟合作的資訊安全廠商,協助他們提供相關更新與防護措施。
如果使用者懷疑已經受到與該漏洞相關的攻擊,建議採取下列3種方式確保設備安全:
1.開啟 Windows 防火牆
2.立即升級更新程式
3.與台灣微軟聯絡尋求支援
此資訊安全相關摘要說明如下:
http://www.microsoft.com/taiwan/technet/security/Bulletin/ms08-oct.mspx
http://www.microsoft.com/taiwan/technet/security/bulletin/ms08-067.mspx
資料來源: http://www.microsoft.com/taiwan/press/2008/10/1024.mspx
(有空大家就去更新系統, 不然到時又會受害...)
在開發WEB Project的時候,常常需要去設定一些安全性權限,但是有些人的XP就是找不到這個標籤。要怎麼解決這個問題?
有兩種方法:
第一種:
1. 在[我的電腦]中,選擇[工具]->[資料夾選項]
2. 在[檢視]中,將[使用建議檔案共用 (建議使用)]取消勾選。
3. 然後你的安全性標籤就會顯示出來了.
第二種:
1. 在[開始]->執行->輸入regedit
2. 找到下列機碼(如果沒有找到,請自行新增),然後將值改為0。
Hive: HKEY_CURRENT_USER
Key: Software\Microsoft\windows\CurrentVersion\Policies\Explorer
Name: Nosecuritytab
Type: REG_DWORD
Value: 1
P.S. 安全性標籤僅能在Administrator權限下使用, 且檔案系統需為NTFS.
下載網址:
Visual Studio 2008 SP1 的 Microsoft® Silverlight™ Tools (RC1)
感謝微軟技術推部門的努力, 讓繁體中文版本很快就推出了.( 註明為Taiwan, 感覺真不錯)
如果網頁出現了這個錯誤訊息,造成的原因可能是NLS_LANG參數沒有正確被設定。
解決辦法:
到 \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE 下有一個 NLS_LANG 機碼
原值可能是 NA 或是空值,把這個值, 改成你想要的字符集, EX: TRADITIONAL CHINESE,或是將這個參數改名。
醞釀兩年的專屬瀏覽器Google Chrome今(2)日正式在線上發表,明(3)天台灣Google辦公室將為台灣媒體舉行產品展示會。根據相關報導指出,Google Chrome藉由強化的網址列及不同於其他瀏覽器的元件,想打造更便利、速度更快的瀏覽網頁習慣,主要鎖定挑戰對象為微軟(Microsoft)的Internet Explorer。
Google Chrome瀏覽器即日起在100多個國家,開放給使用微軟視窗作業系統的電腦下載。此瀏覽器是開放軟體,使用者可自行更寫程式碼,至於適用在蘋果電腦和Linux作業系統的版本,目前還未完成。
參考網址:
http://www.google.com/googlebooks/chrome/
http://www.nownews.com/2008/09/02/339-2329163.htm
--------------------
現在瀏覽器真是越來越多,對於網頁的程式設計師要去調整和注意的地方也就越來越多。面對這個競爭者,微軟這邊要如何因應?這些都值得我們在未來好好觀察。
因為經費的關係,所以微軟研討會很少會到中南部舉辦。
但是在9/5(台中)跟9/12(高雄),微軟針對SilverLight 2.0跟SQL Server 2008這兩項技術,請到了相關領域的專家(董大偉跟胡百敬)到府說明。
而且前120名報到者還有贈送「程式之美」這本好書。
報名網址可以參考下列:
(台中場)
http://www.microsoft.com/taiwan/msdn/events/sqlvssl20/event080905tc.htm
(高雄場)
http://www.microsoft.com/taiwan/msdn/events/sqlvssl20/event080912ks.htm
昨天電腦進入待機狀態後,就無法喚醒。所以我就直接以暴力關機方式來重新開機。
在重開機後,發現區域網路連線出現「網路電纜已拔除」的錯誤訊息,而且也無法撥接上網。這時候看了一下Hub,發現燈沒有亮,這讓我懷疑是網路線壞了,但是平常這條網路線也沒折到,這真是奇怪的狀況。拿了另一條好的網路線來試,發現還是一樣的情況,這下直接就把「網路線壞掉」這個選項給拿掉。
接下來,將區域網路這個連線停用後又重啟,但是仍然沒有用。然後我又把網路卡移除後,重新抓取網路卡,重新開機,但是還是沒有用,還是沒有辦法拿到Hub上的一個燈...Orz
這時候想說,XXX,該不會是網路卡壞掉了吧。之前才去修機殼,現在網路卡不會就這樣壞了吧。心理邊咒罵,手還是繼續研究怎麼解決這個問題。
突然腦筋閃過一個念頭,不然來重現問題好了,我將NB設定進入休眠狀態,然後喚醒後,發現可愛的區域網路又活了過來,Hub也為我顯示了一個燈,嘿嘿,原來之前是網路卡還沒睡醒阿。搞定收工...
PLINQ可能是下一代.NET Framework 4.0 的內建功能(Parallel FX Library, PFX)之一,它包含了Parallel LINQ (PLINQ) and Task Parallel Library (TPL),再搭配F#,下一代能帶給程式設計師提升效能及減少程式複雜的好特性實在不少。
接下來,我以一個簡單的範例來作說明:
1. 首先,開啟一個Console專案,然後在專案中引用System.Threading 這個dll 組件。
2. 我們輸入下列的程式碼:
string[] words = new[] { "Hello", "World", "PLINQ", "IS", "Very", "NOT", "BAD", "!!", "Test", "GOOD" };
var MyQuery = from word in words select word;
foreach (string str in MyQuery)
{
Console.Write(str + '\n');
}
Console.Read();
3. 變更成PLINQ的寫法:
string[] words = new[] { "Hello", "World", "PLINQ", "IS", "Very", "NOT", "BAD", "!!", "Test", "GOOD" };
var MyQuery = from word in words.AsParallel() select word;
MyQuery.ForAll(word => { Console.WriteLine(word); });
Console.Read();
如果你是一個DBA,常常會有清理資料庫內不需要的物件的需求。
但是你又怕砍掉這些物件(Column、Table、View及Store Procedure等)會讓其他依賴這物件的物件變得沒有作用。你可以透過下列語法來建立一個Store Procedure來識別物件的Dependency。
USE master
GO
CREATE PROCEDURE sp_FindDependencies
(
@ObjectName SYSNAME,
@ObjectType VARCHAR(5) = NULL
)
AS
BEGIN
DECLARE @ObjectID AS BIGINT
SELECT TOP(1) @ObjectID = object_id
FROM sys.objects
WHERE name = @ObjectName
AND type = ISNULL(@ObjectType, type)
SET NOCOUNT ON ;
WITH DependentObjectCTE (DependentObjectID, DependentObjectName, ReferencedObjectName, ReferencedObjectID)
AS
(
SELECT DISTINCT
sd.object_id,
OBJECT_NAME(sd.object_id),
ReferencedObject = OBJECT_NAME(sd.referenced_major_id),
ReferencedObjectID = sd.referenced_major_id
FROM
sys.sql_dependencies sd
JOIN sys.objects so ON sd.referenced_major_id = so.object_id
WHERE
sd.referenced_major_id = @ObjectID
UNION ALL
SELECT
sd.object_id,
OBJECT_NAME(sd.object_id),
OBJECT_NAME(referenced_major_id),
object_id
FROM
sys.sql_dependencies sd
JOIN DependentObjectCTE do ON sd.referenced_major_id = do.DependentObjectID
WHERE
sd.referenced_major_id <> sd.object_id
)
SELECT DISTINCT
DependentObjectName
FROM
DependentObjectCTE c
END
EXECUTE sp_ms_marksystemobject 'sp_FindDependecies'
exec sp_FindDependencies 'employees'
現在,你可以直接從KB文章中下載所需要的Hotfix。
過去總是要聯絡微軟技術支援中心,透過技術支援工程師協助才能順利下載,現在你可以直接從網路上下載。但是要注意到語系(ENG 、CHT...)、OS平台(x86、x64以及IA)的相容。完成填表後,不久你就可以收到包含下載連結的email。
若您下載的是SQL Server的hotfix,從SQL Server 2000開始,hotfix具有向前相容的特性(就是後面的hotfix會包含前面hotfix的內容),所以當您找不到某個語言或平台的hotfix時,可以找後面版本的hotfix來作升級。
Scott Gu昨天在他的Blog發表了ASP.NET MVC Preview 3的內容。其中包含了一些更新還有新功能。有興趣的朋友可以去下列網址看看:
http://weblogs.asp.net/scottgu/archive/2008/05/27/asp-net-mvc-preview-3-release.aspx
下載 , ASP.NET MVC Preview 3 framework source code and framework unit tests
The patterns & practices Enterprise Library is a collection of application blocks designed to assist developers with common enterprise development challenges. Application blocks are a type of guidance, provided as source code that can be used "as is," extended, or modified by developers to use on enterprise development projects.
Enterprise Library 4.0是For Visual Studio 2008的版本。
你可以到這裡下載。
如果你在使用上有遇到一些問題,或是想找一些sample code以及教學,可以到codeplex討論群組找看看有沒有解決方法 - http://www.codeplex.com/entlib
今天在MSDN Blog上看到這篇列出檢查步驟的文章,節錄部分內容跟大家分享一下。
連線不通的原因
Basically, when you failed to connect to your SQL Server, the issue could be:
1) Network issue,
2) SQL Server configuration issue.
3) Firewall issue,
4) Client driver issue,
5) Application configuration issue.
6) Authentication and logon issue.
檢查步驟;
Step 1: Network issue
ping -a <your_target_machine>
(use -4 and -6 for IPv4 and IPv6 specifically)ping -a <Your_remote_IPAddress>
nslookup (type your local and remote machine name and IP address multiple times)
If you are not able to ping your target machine, it has high chance that either the network is broken or the target machine is not running. It's possible the target machine is behind a firewall and the firewall blocks the packets sent by ping, though. Windows firewall does not block ping (ECHO) packet by default. The correctness of DNS configuration on the network is vital to SQL connection. Wrong DNS entry could cause of all sorts of connectivity issue later. See this link for example, "Cannot Generate SSPI Context" error message, Poisoned DNS.
Step 2: SQL Server configuration issue
You need to make sure the target SQL Server is running and is listening on appropriate protocols. You can use SQL Server Configuration Manager (SCM) to enable protocols on the server machine. SQL Server supports Shared Memory, Named Pipes, and TCP protocols (and VIA which needs special hardware and is rarely used). For remote connection, NP and/or TCP protocols must be enabled. Once you enabled protocols in SCM, please make sure restart the SQL Server.
You can open errorlog file to see if the server is successfully listening on any of the protocol. The location of errorlog file is usually under:
%ProgramFile%Microsoft SQL Server/MSSQLxx.xxx/MSSQL/Log
If the target SQL instance is a named instance, you also need to make sure SQL Browser is running on the target machine. If you are not able to access the remote SQL Server, please ask your admin to make sure all these happen.
Step 3: Firewall issue
A firewall on the SQL Server machine (or anywhere between client and server) could block SQL connection request. An easy way to isolate if this is a firewall issue is to turn off firewall for a short time if you can. Long term solution is to put exception for SQL Server and SQL Browser.
For NP protocol, please make sure file sharing is in firewall exception list. Both file sharing and NP use SMB protocol underneath.
For TCP protocol, you need put the TCP port on which the SQL Server listens on into exception.
For SQL Browser, please put UDP port 1434 into exception.
Meanwhile, you can put sqlservr.exe and sqlbrowser.exe into exception as well, but this is not recommended. IPSec between machines that we are not trusted could also block some packets. Note that firewall should never be an issue for local connections.
Step 4: Client driver issue
First try:
telnet <your_target_machine> <TCP_Port>
You should be able to telnet to the SQL server TCP port if TCP is enabled. Otherwise, go back to check steps 1-3. Then, use OSQL, SQLCMD, and SQL Management Studio to test sql connections. If you don't have those tools, please download SQL Express from Microsoft and you can get those tools for free.
Possilbe command use be:
osql -E -SYour_target_machine\Your_instance for Windows Auth
osql -Uyour_user -SYour_target_machine\Your_instance for SQL Auth
SQLCMD also applies here. In addition, you can use <“-Stcp:Your_target_machine, Tcp_port” for TCP, “-Snp:Your_target_machine\Your_instance” for NP, and “-Slpc:Your_target_machine\Your_instance” for Shared Memory. You would know if it fails for all protocols or just some specific procotols.
At this stage, you should not see general error message such as error 26 and error 40 anymore. If you are using NP and you still see error 40 (Named Pipes Provider: Could not open a connection to SQL Server), please try the following steps:
a) Open a file share on your server machine.
b) Run “net view file://your_target_machine/” and “net use file://your_target_machine/your_share” (You can try Map Network Drive from Windows Explorer as well)
If you get failure in b), it's very likely you have OS/Network configuration issue, which is not SQL Server specific. Please search on internet to resolve this issue first.
You can try connection using both Windows Authentication and SQL Authentication. If the tests with all tools failed, there is a good chance that steps 1-3 were not set correctly, unless the failure is logon-related then you can look at step 6.
If you succeeds with some of the tools, but fails with other tools, it's probably a driver issue. You can post a question on our forum and give us the details.
You can also use “\windows\system32\odbcad32.exe” (which ships with Windows) to test connection by adding new DSN for various drivers, but that's for ODBC only.
Step 5: Application issue
If you succeed with steps 1-4 but still see failure in your application, it's likely a configuration issue in your application. Think about couple of possible issues here.
a) Is your application running under the same account with the account you did tests in step 4? If not, you might want to try testing in step 4 under that account or change to a workable service account for your application if possible.
b) Which SQL driver does your app use?
c) What's your connection string? Is the connection string compatible to your driver? Please check http://www.connectionstrings.com/ for reference.
Step 6: Authentication and logon issue
This is probably the most difficult part for sql connectivity issues. It's often related to the configuration on your network, your OS and your SQL Server database. There is no simple solution for this, and we have to solve it case by case. There are already several blogs in sql_protocols talking about some special cases and you can check them see if any of them applies to your case. Apart from that, things to keep in mind:
a) If you use SQL auth, mixed authentication must be enabled. Check this page for reference http://msdn.microsoft.com/en-us/library/ms188670.aspx
b) Make sure your login account has access permission on the database you used during login ("Initial Catalog" in OLEDB).
c) Check the eventlog on your system see if there is more information
reference from:
今天上班的時候,黃忠成老大傳給我一篇他剛Po好的文章。仔細一看,這個方法實在太棒了,有一種「黯然銷魂」的感覺。另一方面又覺得黃老大實在很大方,書都還沒推出就先把文章放出來,這種心胸實在很偉大
不多說,有興趣的可以到黃老大那拜訪- http://blog.csdn.net/Code6421/archive/2008/04/15/2292821.aspx
順便推薦一下新書 (拿到看完後再來po心得)-
DataSet1TableAdapters.EmployeeTableAdapter em = new DataSet1TableAdapters.EmployeeTableAdapter();
DataTable dt = new DataTable();
dt = em.GetData();
var mytest = new { Test1 = "123", Test2 = 456, Test3 = 12.34 };
var person = new { Name = "Lolota ", Sex = "Male", Age = 99, MyProfile=dt, my=mytest};
label1.Text = person.MyProfile.Rows[0].ItemArray[1].ToString();
private static void QueryNames(char firstLetter)
{
// Create the query. var is required because
// the query produces a sequence of anonymous types.
var studentQuery =
from student in students
where student.FirstName[0] == firstLetter
select new { student.FirstName, student.LastName };
// Execute the query.
foreach (var student in studentQuery)
{
Console.WriteLine("First = {0}, Last = {1}", student.FirstName, student.LastName);
}
}
Function xxx(ByVal str As String) As String
Return DirectCast(str, Integer)
End Function
Function PrintTypeCode(ByVal obj As Object) As String
Dim objAsConvertible As IConvertible = TryCast(obj, IConvertible)
If objAsConvertible Is Nothing Then
Return obj.ToString() & " does not implement IConvertible"
Else
Return "Type code is " & objAsConvertible.GetTypeCode()
End If
End Function
Imports Microsoft.VisualBasic
Imports System.Runtime.CompilerServices
Module StringExtension
_
Public Function ReturnStr(ByVal str As String) As String
Return "歡迎光臨" & str
End Function
End Module
Private Sub MyTestMothod()
Dim name As String = "John"
name.ReturnStr()
End Sub
Module IntegerExtension
_
Public Function ReturnCount(ByVal ints As Integer) As Integer
Return ints + 10
End Function
End Module
Dim money As Integer = 100
money.ReturnCount()
台灣微軟目前提供了很多的Fix it,讓許多消費者可以不用看完整篇KB,只要按下一個按鈕,就可以幫使用者自動修正許多問題. 現在在Vista以及Windows 7上,微軟也提供了SideBar工具,讓你用最短的時間找到能修正您的電腦的Fix it.(目前為英文版本) ...