Friday, November 30, 2012

My favorite antivirus software ~ it's free, freeware: COMODO Free Internet Security


Why Do I Need Internet Security Suite for My PC?
Comodo Internet Security is the free, multi-layered security application that keeps hackers out and personal information in.
Built from the ground upwards with your security in mind, Internet Security offers 360° protection by combining powerful Antivirus protection, an enterprise class packet filtering firewall, advanced host intrusion prevention and automatic sandboxing of unknown files.
It's free, freeware .
  • Own a Security Suite that will:

    • Secures all connections when you are online
    • Prevents all viruses and online threats
    • Provides fast cloud-based scanning
    • Improves your PC performance and efficiency
    • Upgrade available: additional features and services

Easy Manager Tool for Oracle: Toad for Oralce

 TOAD? empowers developers and DBAs to be more productive by providing an intuitive graphical user interface to Oracle. TOAD is a powerful, low-overheadtool that makes PL/SQL development faster and easier and simplifies database administration tasks. Advanced editors allow users to work on multiple files simultaneously even different file types such as SQL, PL/SQL, HTML, Java, and text. Hot keys, auto-correct, type-ahead, syntax highlighting, version control and numerous other productivity features speed development, while editing and testing are made easier with integrated result sets, explain plans, tracing, and DBMS_OUTPUT views.



TOAD快速入門(簡體)

Toad for Oracle Download Page

ASPX ASP.NET Drawing Dynamic Image

You can use several tools to draw dynamic image on aspx, like :MicroSoft Silverlight APP, or you can use Raphael JS JavaScript Library to do this, it simplify your work with vector graphics on the web and currently it supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+.

http://raphaeljs.com/


To be Continued~~

p.s.Next we will talk about how to drawing dynamic image (like: color , text...etc.) on aspx with data from DB.

Thursday, November 29, 2012

ASPX Convert RGB to Hex Color with VB


    Private Function RGB_2_HEX(ByVal R As Byte, ByVal G As Byte, ByVal B As Byte) As String
        Return "#" & Hex(Color.FromArgb(R, G, B).ToArgb).Substring(2)
    End Function

ASPX GridView Edit, Cancel Edit, Updating with VB


Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView4.RowEditing
        GridView1.EditIndex = e.NewEditIndex
        bindGridView1()
End Sub


 Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView4.RowCancelingEdit
        GridView1.EditIndex = -1
        bindGridView1()
 End Sub


Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView4.RowUpdating

' do something ~~like update DB or insert into DB
 GridView1.EditIndex = -1
 bindGridView4()

End Sub

   




Sub bindGridView1()
        Dim SQL As String=session("orignal_sql_string")
        If SortField.ToString() <> "" Then
            SQL = SQL & "order by " & SortField.ToString()
        Else
            ' SQL = SQL & "order by form_idx ASC "
        End If
        Try
            Dim ds As DataSet = GetTableData(SQL)
            GridView1.DataSource = ds
            GridView1.DataBind()
           Catch ex As Exception
            '  lbErrorMessage.Text = ex.Message
        End Try
End Sub


ASPX GridView Sorting with VB



Protected Property SortField() As String
        Get
            If IsNothing(ViewState("SortField")) Then
                ViewState("SortField") = ""
            End If
            Return ViewState("SortField")
        End Get
        Set(ByVal value As String)
            Dim field As String = ""
            Dim dir As String = ""
            If IsNothing(ViewState("SortField")) Then
                ViewState("SortField") = ""
                field = ""
            Else
                field = CStr(ViewState("SortField"))
                If field.Length > 4 Then
                    dir = Right(field, 4).Trim
                    field = Left(field, field.Length - 4).Trim
                End If
            End If
            If value = field Then
                If dir = "ASC" Then
                    ViewState("SortField") = value + " DESC"
                Else
                    ViewState("SortField") = value + " ASC "
                End If
            Else
                ViewState("SortField") = value + " ASC "
            End If
        End Set
    End Property


Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
        SortField = e.SortExpression
        bindGridView1()
    End Sub


Sub bindGridView1()
        Dim SQL As String=session("orignal_sql_string")
        If SortField.ToString() <> "" Then
            SQL = SQL & "order by " & SortField.ToString()
        Else
            ' SQL = SQL & "order by form_idx ASC "
        End If
        Try
            Dim ds As DataSet = GetTableData(SQL)
            GridView1.DataSource = ds
            GridView1.DataBind()
           Catch ex As Exception
            '  lbErrorMessage.Text = ex.Message
        End Try
End Sub


Insert or Update Data to Oracle DB with ASPX VB

Function Update_Insert_TableData(Byval InsertString as String) as System.Data.Dataset
  Dim Connection as New OracleConnection(myconnectionString)
  Dim adapter as New OracleDataAdapter(queryString,connection)
  connection.open()
  adapter.ExecuteNoneQuery()
  conneciton.Close()
  connection.Dispose()
End Function

使用aspx與VB連結oracle資料庫 connect Oracle DB with Aspx and VB

4 Steps~
1. Add oracle DB connect config in Web.config file.
2. Import System.Data.OracleClient in VB file. (exp: myjob.vb)
3. Define Connectionstring in VB file.
4. Set Getdata  Function for connect DB
5. Get data



Step1:
Find the web.config file in the root Directory of aspx, and add the DB connect config.

<connectionStrings>
<add name="this_is_the_connectionstring_name" connectionString="Data Source=database_name;Persist Security Info=True; User ID=db_user_id;Password=db_password" providerName="System.Data.OracleClient" />
</connectionStrings>


Step2:
Imports System.Data.OracleClient

Step3:
Private myconnectionString as String= ConfigurationManager.ConnectionStrings("this_is_the_connection_name").ConnectionString

Step4:
Function GetTableData(ByVal queryString as String) as System.Data.Dataset
  Dim ds as New System.Data.Dataset()
  Try
     Dim connection as New OracleConnection(myconnectionString)
     Dim adapter as New OracleDataAdapter(queryString,connection)
     adapter.Fill(ds)
  Catch ex as Exception
  End Try
  Return ds
End Function

Step5:
Dim sql as String="select * from test_table "
Dim test_dataset as System.Data.Dataset=GetTableData(sql)



Now, You can use the test_dataset to do something~