Thứ Hai, 19 tháng 2, 2018

Kendo. Globalized

<script src="http://cdn.kendostatic.com/2014.2.716/js/cultures/kendo.culture.en-GB.min.js"></script>
 
<script type="text/javascript">
     //set current to the "en-GB" culture script
     kendo.culture("en-GB");
</script>

Thứ Ba, 24 tháng 10, 2017

DataReader

  1. Multiples Table in DataReader
    using (var con = new SqlConnection(Properties.Settings.Default.ConnectionString))
    {
        using (var cmd = new SqlCommand("SELECT TOP 10 * FROM tabData; SELECT TOP 10 * FROM tabDataDetail;", con))
        {
            int rowCount = 0;
            con.Open();
            using (IDataReader rdr = cmd.ExecuteReader())
            {
                while (rdr.Read())
                {
                    String object1 = String.Format("Object 1 in Row {0}: '{1}'", ++rowCount, rdr[0]);
                }
                if (rdr.NextResult())
                {
                    rowCount = 0;
                    while (rdr.Read())
                    {
                        String object1 = String.Format("Object 1 in Row {0}: '{1}'", ++rowCount, rdr[0]);
                    }
                }
            }
        }
    }
    
    https://stackoverflow.com/questions/12969318/multiples-table-in-datareader

Thứ Tư, 10 tháng 2, 2016

Creating Virtual Directory In Apache

Usually, we have to put our web application inside the document root of Apache in order to make the application accessible from the network. However, there is a trick to make the web application still accessible even though we put it outside of Apache's document root. Yes, this can be done by creating a virtual directory.

Usually, we have to put our web application inside the document root of Apache in order to make the application accessible from the network. However, there is a trick to make the web application still accessible even though we put it outside of Apache's document root. Yes, this can be done by creating a virtual directory.
 
Apache mod_alias
 

Thứ Sáu, 5 tháng 2, 2016

How to Change localhost to a Domain Name

Redirecting the Web Site to Your Computer


1) Locate your hosts file. In Windows XP, this file is located in C:\WINDOWS\system32\drivers\etc
2) Open the file with a plain text editor (like Notepad++). Using a word processor, like Word, can mess up the file when you save it
3) Add lines containing the domain name(s) and IP address to redirect to. 

Thứ Tư, 18 tháng 11, 2015

ASP, ReadExcelClass

<%
'###########################################################################################################################
'    Thaihn, 15-11-2015
'###########################################################################################################################
' fileName = "aaaaaa.xls"
' file = Server.MapPath(fileName)

' dim ec
' set ec = new ReadExcelClass
' set rs = ec.SetDebug(true).File(file).SetWorkSheetIndex(0).SetPageSize(10)

' for i = 1 to ec.TotalPage()
    ' for j = 1 to ec.Page(i).RowsPerPage()
        ' line = (i - 1) * ec.PageSize + j
        ' Response.Write "
("&i&","&j&")"& line &": "& ec.Cell(j, "Contract") ' next ' Response.Write "
============================================================================================" ' next ' ec.Close() '########################################################################################################################### class ReadExcelClass private objConnection private objCatalog private objRecordset private pFile private pWorkSheets() private pWorkSheet private pQuery private pKeys() private pTotalRecords private pPageSize private pPage private adOpenStatic private adLockOptimistic private adCmdText private debug function File(sFile) pFile = sFile ' pConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="& file &";Extended Properties=""Excel 8.0;HDR=Yes;""" ' 2007, .xlsx, can write pConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& pFile &";Extended Properties=""Excel 8.0;HDR=Yes;"";" ' 2003, .xls, can write ' pConnection = "DRIVER={Microsoft Excel Driver (*.xls)};DriverId=790;DBQ="& pFile &";" ' read only Set objConnection = CreateObject("ADODB.Connection") objConnection.Open pConnection GetAllWorkSheet() set File = me end function function GetAllWorkSheet() dim i set objCatalog = Server.CreateObject("ADOX.Catalog") objCatalog.activeConnection = objConnection ReDim Preserve pWorkSheets( objCatalog.Tables.Count - 1 ) for i = 0 to objCatalog.Tables.Count - 1 pWorkSheets(i) = Left(objCatalog.Tables(i).Name, Len(objCatalog.Tables(i).Name) - 1) next set objCatalog = nothing end function function SetWorkSheet(sWorkSheet) pWorkSheet = sWorkSheet ' GetKeys() ' pQuery = "Select "& pKeys(0) &" FROM ["& pWorkSheet &"$]" ' objRecordset.Open pQuery, objConnection, adOpenStatic, adLockOptimistic, adCmdText ' pTotalRecords = objRecordset.RecordCount if objRecordset.State = 1 then objRecordset.Close pQuery = "Select * FROM ["& pWorkSheet &"$]" Trace "pQuery", pQuery objRecordset.Open pQuery, objConnection, adOpenStatic, adLockOptimistic, adCmdText set SetWorkSheet = me end function function SetWorkSheetIndex(index) ' Trace "pWorkSheets("&index&")", pWorkSheets(index) SetWorkSheet pWorkSheets(index) set SetWorkSheetIndex = me end function function GetKeys() dim i pQuery = "Select top 1 * FROM ["& pWorkSheet &"$]" objRecordset.Open pQuery, objConnection, adOpenStatic, adLockOptimistic, adCmdText objRecordset.Close ReDim Preserve pKeys( objRecordset.Fields.Count - 1 ) for i = 0 to objRecordset.Fields.Count - 1 pKeys(i) = objRecordset.Fields(i).Name next set GetKeys = me end function function SetPageSize(iPageSize) pPageSize = iPageSize set SetPageSize = me end function function PageSize() PageSize = pPageSize end function function Page(iPage) pPage = iPage Trace "Page", iPage set Page = me end function function TotalPage() TotalPage = int(objRecordSet.RecordCount / pPageSize) + 1 Trace "TotalPage", TotalPage end function function RowsPerPage() if pPage < TotalPage then RowsPerPage = pPageSize else RowsPerPage = objRecordSet.RecordCount - (pPageSize * (pPage - 1)) end if Trace "RowsPerPage", RowsPerPage end function function Cell(row, col) dim record record = (pPage-1) * pPageSize + (row - 1) Trace "record", record Trace "Cell", record objRecordSet.Move record, 1 on error resume next Cell = objRecordset.Fields(col) if err.number <> 0 then on error goto 0 err.raise 1, "Cell error", "row = "& row &", col = "& col end if on error goto 0 end function function Row(index) dim record record = (pPage-1) * pPageSize + (row - 1) objRecordSet.Move record, 1 set Row = objRecordset end function function RowIndex(i, j) RowIndex = (i - 1) * PageSize + j end function function GetRecords() set GetRecords = objRecordset end function function SetDebug(value) debug = value set SetDebug = me end function function Trace(name, value) if debug then Response.Write "

--> "& name &" = "& value &"

" set Trace = me end function function Close() set objRecordset = nothing ' set objCatalog = objCatalog objConnection.Close set objConnection = nothing end function Private Sub Class_Initialize() debug = false adOpenStatic = 3 adLockOptimistic = 3 adCmdText = &H0001 Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") End Sub Private Sub Class_Terminate() End Sub end class '================================================================================ Function ReadExcel( myXlsFile, mySheet, my1stCell, myLastCell, blnHeader ) ' http://www.robvanderwoude.com/vbstech_databases_excel.php ' Function : ReadExcel ' Version : 3.00 ' This function reads data from an Excel sheet without using MS-Office ' ' Arguments: ' myXlsFile [string] The path and file name of the Excel file ' mySheet [string] The name of the worksheet used (e.g. "Sheet1") ' my1stCell [string] The index of the first cell to be read (e.g. "A1") ' myLastCell [string] The index of the last cell to be read (e.g. "D100") ' blnHeader [boolean] True if the first row in the sheet is a header ' ' Returns: ' The values read from the Excel sheet are returned in a two-dimensional ' array; the first dimension holds the columns, the second dimension holds ' the rows read from the Excel sheet. ' ' Written by Rob van der Woude ' http://www.robvanderwoude.com Dim arrData( ), i, j Dim objExcel, objRS Dim strHeader, strRange Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 ' Define header parameter string for Excel object If blnHeader Then strHeader = "HDR=YES;" Else strHeader = "HDR=NO;" End If ' Open the object for the Excel file Set objExcel = CreateObject( "ADODB.Connection" ) ' IMEX=1 includes cell content of any format; tip by Thomas Willig. ' Connection string updated by Marcel Niënkemper to open Excel 2007 (.xslx) files. objExcel.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _ myXlsFile & ";Extended Properties=""Excel 12.0;IMEX=1;" & _ strHeader & """" ' Open a recordset object for the sheet and range Set objRS = CreateObject( "ADODB.Recordset" ) strRange = mySheet & "$" & my1stCell & ":" & myLastCell objRS.Open "Select * from [" & strRange & "]", objExcel, adOpenStatic ' Read the data from the Excel sheet i = 0 Do Until objRS.EOF ' Stop reading when an empty row is encountered in the Excel sheet If IsNull( objRS.Fields(0).Value ) Or Trim( objRS.Fields(0).Value ) = "" Then Exit Do ' Add a new row to the output array ReDim Preserve arrData( objRS.Fields.Count - 1, i ) ' Copy the Excel sheet's row values to the array "row" ' IsNull test credits: Adriaan Westra For j = 0 To objRS.Fields.Count - 1 If IsNull( objRS.Fields(j).Value ) Then arrData( j, i ) = "" Else arrData( j, i ) = Trim( objRS.Fields(j).Value ) End If Next ' Move to the next row objRS.MoveNext ' Increment the array "row" number i = i + 1 Loop ' Close the file and release the objects objRS.Close objExcel.Close Set objRS = Nothing Set objExcel = Nothing ' Return the results ReadExcel = arrData End Function %>