Directory
Technology
Blog Details for "Code Libary of e-July"
Code Libary of e-JulyCode Libary of e-JulyJust Blog About Programming issues and solutions
Articles:
1, 2
Articles
Server.MapPath Method
2007-12-29 15:36:00 If you need to go to a file from your page, you may need to know the exact file path in order to access to it. In this case, you can use Server .MapPath method.Server.MapPath method takes a path as a parameter and returns the physical path corresponding to the path.For example, there is an xml file (database.xml) which stored a list of connection string is located in the C:inetpubwwwrootwebapplication1database directory, and you need to get the connection string to connect to an appropriate database. The C:inetpubwwwroot directory is set as the web root directory.The script uses the slash character to specify that the path returned should treated as a complete virtual path on the server and mapped from the root folder.string path = Server.MapPath(?/webapplication1/database /database.xml?)This script will output as the following:C:inetpubwwwrootwebapplication1 databasedatabase.xmlIf the passed parameter does not start with a slash character, it will map to its current direct... More About: Method
List of Parameters Supported by Windows Media Player 7 and Later Version
2007-12-28 15:07:00 By adding some PARAM elements in your Windows Media Player object, you can decide the outlook and the functionality of your Windows Media Player. It enables you to specify certain player properties when the page is browsed. Below is a list of common parameters supported by Windows Media Player and later version.autoStartDefault: trueDescription: Specifies or retrieves a value indicating whether the current media item begins playing automatically.balanceDefault: 0Description: Specify the current stereo balance.baseURLDefault: -Description: Specifies the base URL used for relative path resolution with URL script commands that are embedded in media items.captioningIDDefault: 0Description: Specifies the name of the element displaying the captioning.currentMarkerDefault: 0Description: Specifies the current marker number.currentPositionDefault: 0Description: Specifies the current position in the media item in seconds.defaultFrameDefault: -Description: Specifies the name of the frame used ... More About: List
Template Column VS Bound Column
2007-12-20 06:27:00 This post will explain how to get information from your data grid for Template Column and Bound Column. There is so many times that when I am trying to retrieve the value of certain column from a data grid, I can get the value of the first column (Bound Column). However, I cannot get the value of the second column (Template Column). And both of the columns are not empty though.The explanation below is what I had found out finally.Basically, the difference between BoundColumn and TemplateColumn is that you have more control over what and how things are rendered in TemplateColumn. For example, you can decide what controls are used when editing. With Bound Column creates column bound to a field in the data source and rendered in a table cell. You can use a cell?s Text property to get whatever text is there. But please note that this only works for Bound Column.Here is a sample of HTML code:<asp:BoundColumn DataField="COUNTRY" HeaderText="Country">   ; <Heade...
Hiding and Showing Columns in the Data Grid
2007-12-18 14:06:00 Some programmers have face the problem controlling the visibility of certain column in the Data Grid control. In this post, I will show you how to hide and show certain column in the data grid.Data grid control has a property called AutoGenerateColumns . By default, its values is set to True, which will contain all of the column names of the data set as you bind it with the data set. If you set the AutoGenerateColumns to True, then you would not be able to control the visibility of the columns. You can either use asp:BoundColumn or asp:TemplateColumn. For asp:BoundColumn, you need to specify the HeaderText and its DataField. Here is a tiny part of html sample code:<asp:BoundColumn DataField="COUNTRY" HeaderText="Country">   ; <HeaderStyle Font-Size="11px" > </HeaderStyle& gt; <ItemStyle Font-Size="10px" > </ItemStyle> ;</asp:BoundColumn><asp:BoundCol umn DataFiel...
Server.Transfer VS Server.Execute
2007-12-14 14:38:00 Server.Transfer Server.Transfer takes the control execution of the page to the new page and thereafter it doees not return to the original page. This execution happens at the server side and the client is unaware of the change, and hence it maintains the original URL. Server.ExecuteIn Server.Execute method, a URL is passed as a parameter, and the control moves to this specified page. Execution of code happens on this specified page. Once the execution is over, the control will return to the original page. This method is very useful if you want to execute something in a specified page, and then come back to the original page.The URL in the browser also remains the original form's URL. Subscribe in a reader More About: Server
Server.Transfer VS Response.Redirect
2007-12-12 15:02:00 Example: A webform1.aspx wants to send the user to webform2.aspx.Response .Redirect Response.R edirect method simply causes the client browser to move to another specified URL, as code below:Response.Redirect(?webform2.aspx?)W hen it is called, it will send a 302 (Object Moved) redirect header to the client browser, telling it that webform1.aspx has moved to webform2.aspx and then the browser will send a request to the server for webform2.aspx. When the browser receives responses from the server, it uses the header information to generate another HTTP request to the new URL. For this method, the redirection happens at the client side, so it involves 2 round trips to the server: request the original page, and request for the redirected page.When webform1.aspx is redirected to webform2.aspx, query string parameters in webform1.aspx are unavailable in webform2.aspx. If you want to pass value from webform1.aspx to webform2.aspx, you have to pass it either by query string parameters or store... More About: Transfer , Server , Rect
Adding an embedded Windows Media Player on HTML document
2007-12-11 14:30:00 This article describes how to embed Windows Media Player to play music or video in HTML document, it also includes required code in HTML and JavaScript.To embed Windows Media Player, you need to add an OBJECT element for the Windows Media Player ActiveX control. Here is the code to add the OBJECT element on your web page.<HTML><HEAD><TITLE> ;Embedded Windows Media Player Web Page</TITLE></HEAD><BODY&g t;<OBJECT ID="Player" width="320" height="240" CLASSID="clsid:6BF52A52-394A-11d3-B153-00 C04F79FAA6"></OBJECT></BODY&g t;</HTML>As you can see, there is a CLASSID number there. This CLASSID may differ depends on the Windows Media Player?s version. The CLASSID is for Windows Media Player 7, 9, 10 and 11. If you want to embed Windows Media Player 6.4 instead of the latest version, the class ID is clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E9 5. Add PARAM ParametersBesides, you can decide the player?s functionality by adding some PARAM element... More About: Document
Column Chart in Microsoft Excel
2007-12-09 13:53:00 Charts or graphs are an important part of your spreadsheets to summarize your data, and allow you to see clearly the data trends and patterns in your spreadsheets. Here I will provide a step by step tutorial on creating a Column Chart in Excel .First step of all, you need to enter the data into the spreadsheet. From the figure below, you can see an example of data.Using your mouse to drag and highlight the cells that contain the titles and data to be included in the column chart. Next, you need to select a chart type that you preferred the most. Choose menu Insert -> Chart. A Chart Wizard will appear as shown below. Choose you desired type and click Next. You can format your column chart, such as adding a title, Category (X) axis and Value (Z) axis to the chart, shows label which contains series name, category name or value, shows data table on your chart, and etc.Click Next to continue, you can then choose to put the formatted chart to a new sheet or existing sheet. Click Finish. No... More About: Microsoft , Chart , Microsoft Excel
Import data from CSV file into data set
2007-12-07 14:59:00 In this post, I am going to use the OLE DB Provider for Jet to connect to and query CSV file and then load the data into a dataset.First of all, I will import the following namespaces:Import s System.Data Imports System.Data.OleDbAnd then there is a function which will load data from a CSV file and return a dataset.Private Function LoadCsvData(ByVal filename As String) As DataSet 'Create a new connection Dim conn As New OleDbConnection("Provider=Microsoft.Jet.O LEDB.4.0;" & _ "Data Source=C:;" & _ "Extended Properties='text;HDR=Yes;FMT=Delimited'") 'Query the csv file 'Example of file name ? Test_CSV.csv Dim cmd As New OleDbCommand("select * from " & filename, con) Dim da As New OleDbDataAdapter(cmd) Dim ds As New DataSet 'Open connection conn.Open() 'Fill the data set using the data adapter da.Fill(ds) 'Close the connection conn.Close() 'Return the dataset R... More About: File
Simple script to play music on a HTML document
2007-12-06 14:34:00 You can use this EMBED script to play a music in HTML document.Take a look at the example below. Hope this will help you work it out.<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta name="description" content="play music"><meta name="GENERATOR" content="Microsoft FrontPage 3.0"><title>Play music<SCRIPT language=JavaScript type=text/javascript><!-- function StartPlay (){document.track.Play()}function StopPlay(){document.track.Stop()}// --></script></head><bod y ><EMBED SRC="your_song.wav" name="track" autostart="false" hidden="true" loop="true"> </EMBED><input type="button" onclick="StopPlay()" value="Stop"><input type="button" onclick="StartPlay()" value="Play"></body></html> ;Note: To make it work, you still need any version of Windows Media Player to be installed in your computer, else a plug-in error will occurred. Subscribe in a reader More About: Music , Simple , Document
Create Folder in MS Access
2007-12-05 14:59:00 Let say you want to create a new folder if it does not exist when you run your application, here is the sample code:Dim strFolder As StringstrFolder = "C:New Folder"Dim fsoSet fso = Create Object("Scripting.FileSystemObject" )?Check whether the folder existsIf Not fso.FolderExists(strFolder) Then FileSystem.MkDir (strFolder)End If Subscribe in a reader More About: Access
How to install a Font in Windows
2007-12-04 14:11:00 1. Choose Start -> Settings -> Control Panel. Note: In Windows XP, choose Start -> Control Panel.2. Double-clicks the Font s icon.3. Choose File -> Install New Font.4. Use the Folders Directory box to go to the location where the font was saved. (Use the "Drives" drop-down to select the appropriate drive, if not "C:")5. The font(s) in the selected folder will display in the "List of Fonts" box. Use Ctrl+click to select individual fonts to install, or the "Select All" button to include the whole list. 6. Click "OK" and the fonts will be installed and copied into the Fonts directory. The desired font is now available for use! Subscribe in a reader More About: Computer
Create a New Recordset in VBA
2007-12-03 14:09:00 Here is the sample code on how to create a new recordset.Sub Create _recordset()Dim rst As New ADODB.Recordset?Add columnsrst.Fields.Append ?Field1?, adVarchar, 50rst.Fields.Append ?Field2?, adVarchar, 50??Create recordsetrst.Open()?Add rows into recordsetrst.AddNew Array("field1", "field2"), Array("string1", ?val1?)rst.AddNew Array("field1", "field2"), Array("string2", ?val2?)End SubHappy programming! Subscribe in a reader
VBA Worksheet
More articles from this author:2007-12-01 06:06:00 Delete worksheets For Each ws In oWB.Worksheets ws.DeleteNextAdd a worksheetSub Add_Sheet()Dim wSht As WorksheetDim shtName As StringshtName = Format(Now, "mmmm_yyyy")For Each wSht In Worksheets If wSht.Name = shtName Then MsgBox "Sheet already exists! " Exit Sub Else Sheets.Add.Name = shtName Sheets(shtName).Move After:=Sheets(Sheets.Count) Sheets("Sheet1").Range("A1:A5").Copy _ Sheets(shtName).Range("A1") End IfNextEnd SubCopy a worksheetSub Copy_Sheet()Dim wSht As WorksheetDim shtName As StringshtName = "NewSheet"For Each wSht In Worksheets If wSht.Name = shtName Then MsgBox "Sheet already exists! " Exit Sub Else Sheets(1).Copy before:=Sheets(1) Sheets(1).Name = shtName Sheets(shtName).Move After:=Sheets(Sheets.Count) End IfNext End Sub Subscribe in a reader 1, 2 |



