跳到主要內容

發表文章

目前顯示的是 2010的文章

T-SQL Cursor Loop Sample

GO DECLARE @value1 varchar(50) DECLARE @value2 varchar(50) DECLARE my_cursor CURSOR FOR SELECT Value1,value2 FROM TableName OPEN my_cursor FETCH NEXT FROM my_cursor INTO @value1,@value2 WHILE @@FETCH_STATUS = 0 BEGIN print @value1 + ':' + @value2 /*Main Process Start*/ FETCH NEXT FROM my_cursor INTO @value1,@value2 end CLOSE my_cursor DEALLOCATE my_cursor

R Project with ODBC

1.Setting ODBC in windows Control panel 2.install R package "RODBC" 3.In R Command Line > library(RODBC) > channel = odbcConnect("$ODBC_Name") //Create Connection > odbcGetInfo(channel) //Get odbc connection info > odbcQuery(channel,"$SQL_command") //Set SQL Command String > sqlGetResults(channel, max=$TopNumber) //get top N Data

IE7 preivew Local image in html page

Use the IE filter "AlphaImageLoader" and javascript in Header <style type="text/css"> #newPreview { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale); } </style> <script type="text/javascript" language="javascript"> <!-- function PreviewImg(imgPath) { //IE6﹜IE7﹝ var newPreview = document.getElementById("newPreview"); newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgPath; } --> </script> in body <div id="newPreview" ></div>

[.net]IComparable Interface

Sorting Example Imports System.Collections Public Class Temperature Implements IComparable ' The temperature value Protected temperatureF As Double Public Overloads Function CompareTo( ByVal obj As Object ) As Integer _ Implements IComparable.CompareTo Dim otherTemperature As Temperature = TryCast(obj, Temperature) If otherTemperature IsNot Nothing Then Return Me .temperatureF.CompareTo(otherTemperature.temperatureF) Else Throw New ArgumentException( "Object is not a Temperature" ) End If End Function Public Property Fahrenheit() As Double Get Return temperatureF End Get Set ( ByVal Value As Double ) Me .temperatureF = Value End Set End Property Public Property Celsius() As Double Get Return (temperatureF - 32) * (5/9) End Get Set ( ByVal Value As Double ) Me .temperatureF = (Value * 9/5...

[.Net] List(Of T).Find (Predicate(Of T))

Find Object in List Method 1 Function PredicatFunction( ByVal tempProduct As Product) as boolean Return tempProduct.ProductID='MyID' End Function Dim MyList As List(Of Product)=new List(Of Product) Dim tmpProduct as Product=MyList.Find(AddressOf PredicatFunction ) Mothod 2 Dim ProductID as String='MyID' Dim MyList As List(Of product)=new List(Of product) Dim tmpProduct as Product=MyList.Find(Function(n) n.ProductID=productID )

[Oracel] ORA-01654 unable to extend index

When ORA-01654 happened, It is due to the tablespace is not enough. So, you can set the tablespace to autoextensibe, and create a new datafile for the tablespace. 1.check your tablespace autoextensible Select tablespace_name , autoextensible from dba_data_files; 2. Alter database datafile autoextend Alter database datafile ' ' autoextend on maxsize 10000M; 3.Alter tablespace to add a new datafile Alter tablespace add datafile ' ' size 1000M ; Size unit is MB

[Asp.net] asp.net MVC 2.0 in Old Version IIS

when you deploye asp.net MVC 2.0 to old version IIS (5.0,6.0) WebSite , you may meet some troubles. 1.IIS don't run on .Net Framework 3.5!! After you FTP / deploye your file to Website, You should copy the all .Net Framework 3.5 DLL file into the "bin" folder in your website. the .Net Framework 3.5 DLL files are in this path C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5 2. Website didn't install asp.net MVC 2.o You can copy the "System.Web.Mvc.dll" to the "bin" folder System.Web.Mvc.dll in C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll 3. Can't not find the VB/VC Complier ,because the Complier version is too old. Because there is a setting in web.config <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture...

[Java]eclipse 無法啟動

Eclipse 無法啟動 出現 JVM terminated. Exit code=-1 的錯誤訊息 打開eclipse根目錄下 eclipse.ini檔 -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256M -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m 將 -Xms40m 改成 -Xms128m -Xmx512m 改成 -Xms256m 即可 參考資料

[8051]Introduction

1.Inner structure

[J2ME] Hello World

Create a form with "Hello World" and add a Exit Command to exit the process. import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorld extends MIDlet implements CommandListener { private Display display; private Command exitCommand; private Form form; public HelloWorld() { display=Display.getDisplay(this); exitCommand = new Command("Exit", Command.EXIT,1); form=new Form("My J2ME Hello World!"); form.append("Welcome to J2ME!"); form.addCommand(exitCommand); form.setCommandListener(this); } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } protected void pauseApp() { } public void commandAction(Command cmd, Displayable disp) { if (cmd == exitCommand) { try{ destroyApp(false); } catch(MIDletStateChangeException ex ){ System.out.println(ex.getMessage()); ...

[8051]MCB 8051MicroControl Class Note

Use Keil C to Complie 8051 Program, and Write to ROM 1. Create New Project Project -> New Project 2.Select Device for Target A. Choice "Data Base Contact" belong your MicroControl Chip (we use Atmel. AT89C52) B. Set "Optionals for Target" ->[Target]->[Xtal] , [Output]->[Create HEX File] 3.Write the C Code 4.bulid Project 5. Open Chip-Writer Program 6. Set the Chip Type 7. Load .Hex Code 8. Test Board switch to Write-Mode and Trun On 9. Write to ROM 10. Reset Borad in Use-Model to Test Program

[.net] Load and play Flash file (swf) in .net app

1. Add “COM Components”“Shockwave Flash Object” to Toolbox 2. Add axshockwaveFlash Ojbect to your form and name "MyFlash" 3. use OpenFileDialog to load .swf open = New OpenFileDialog open.Filter = "Image Files(*.swf)|*.swf" If (open.ShowDialog() = DialogResult.OK) Then MyFlash.Movie = open.FileName End If 4. use Play /Stop contorl swf MyFlash.play() MyFlash.stop()

[.Net] Html.RenderAction/RenderPartial send parameter

Html.RenderAction/RenderPartial can send parameter by routeValues in Global.asax.vb routes.MapRoute( _ "Default", _ "{controller}/{action}/{id}/{parameter}", _ New With {.controller = "Home", .action = "Index", .id = "" , .parameter="" } _ ) in View(.aspx) < %Html.RenderAction("Login", "Member", New With {.id = "1234", .parameter="ABC"})%> <%Html.RenderPartial("Login", "Member", New With {.id = "1234", .parameter="ABC"})%> in Control(.vb) Dim id As String = RouteData.Values("id") Dim parameter As String = RouteData.Values("parameter")