Santosh's profileSantosh KumarPhotosBlogListsMore ![]() | Help |
VB.Net, Finding very first day number for Sun, Mon, ..., Sat of the YearPublic Shared Function GetVery1stDayNoOfTheYear(ByVal faDay As String, ByVal faYear As Integer) As Integer
Dim vRet As Integer = 0 For vRet = 1 To 7 If UCase(Format(CDate("0" & vRet & "-Jan-" & faYear), "ddd")) = UCase(faDay) Then Exit For End If Next Return vRet End Function Input: GetVery1stDayNoOfTheYear("SUN",2008), Output: 6
Input: GetVery1stDayNoOfTheYear("SUN",2009), Output: 4 Input: GetVery1stDayNoOfTheYear("MON",2009), Output: 5»»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com
ASP.Net, Designing a site visit counter moduleThere are many sites offering visit analysis for your web site including google. Once you register with them, you will get some client side script. You can put them in each of your page, and thing are over. You can try your own visit analysis module with the help of the following codes. It uses an xml file i.e. AppVisitCount.Xml, the structure is given below. All you need is to call the following functions LetVisitCount(): For page load of every aspx file or master file GetVisitCount(): To know the current visit count GetCountBoard(): To have the following output
You can also write additional functions to maintain a database level logs for capturing statistics for various analysis. The function LetVisitCount() is the right place for calling your functions for such data captures. '''''''''file:AppVisitCount.Xml <?xml version="1.0" standalone="yes"?> <table> <row> <hitcounter>15081947</hitcounter> </row> </table> '''''''''code:forVisitCount Imports Microsoft.VisualBasic Imports System.Data Imports System.Xml Imports System.IO Private Shared Function GetVisitCount() As Long Dim vDs As New DataSet Dim vHits As Long = 0 vDs.ReadXml(HttpContext.Current.Request.PhysicalApplicationPath & "\AppVisitCount.Xml") vHits = CLng(vDs.Tables(0).Rows(0).Item("hitcounter").ToString) Return vHits End Function Public Shared Sub LetVisitCount() Dim vHits As Long = 0 If HttpContext.Current.Session("hitcounter") Is Nothing Then vHits = SetVisitCount() HttpContext.Current.Session("hitcounter") = vHits Else vHits = GetVisitCount() End If End Sub Public Shared Function GetCountBoard() As String Dim vHitsBoard As String = "" If Not HttpContext.Current.Session("Hits") Is Nothing Then Dim vHits As String = Format(CLng(HttpContext.Current.Session("hitcounter")), "0000000") Dim vCnt As Integer = Len(vHits) Dim vCtr As Integer = 0 vHitsBoard = vHitsBoard & "<table border=1 cellpadding=1 cellspacing=0><tr>" For vCtr = 1 To vCnt vHitsBoard = vHitsBoard & "<td height=25px bgcolor='#000000' " vHitsBoard = vHitsBoard & "style='color:#ffffff;font-weight:bold'>" vHitsBoard = vHitsBoard & Mid(vHits, vCtr, 1) & "</td>" Next vHitsBoard = vHitsBoard & "</tr></table>" End If Return vHitsBoard End Function Private Shared Function SetVisitCount() As Long Dim vDs As New DataSet Dim vHits As Long = 0 vDs.ReadXml(HttpContext.Current.Request.PhysicalApplicationPath & "\AppVisitCount.Xml") vHits = CLng(vDs.Tables(0).Rows(0).Item("hitcounter").ToString) + 1 vDs.Tables(0).Rows(0).Item("hitcounter") = vHits vDs.WriteXml(HttpContext.Current.Request.PhysicalApplicationPath & "\AppVisitCount.Xml") Return vHits End Function »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com ASP.Net, Downloading files and images which are kept outside the web application folderThere are many situations where your application requires giving facilities for uploading files. If this files require sharing publically you should keep it in your web application folder so that search engines can easily search it and index then. This will also help you to ease your site search engines also. But it not a good idea to keep it inside your web application folder if you want to make it secured from unauthorized access. In such case you must keep this folder outside. But this will restrict you to use href tag from downloading. The following code will help you. Imports Microsoft.VisualBasic Imports System.Data Imports System.IO Public Shared Function DoDownload_File(ByVal faType As String, ByVal faFile As String, ByVal faPath As String) As Boolean Dim vRet As Boolean = False Try HttpContext.Current.Response.ContentType = "application/" & faType HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" & faFile) HttpContext.Current.Response.TransmitFile(faPath) HttpContext.Current.Response.End() vRet = True Catch ex As Exception vRet = False Finally 'doNothing End Try Return vRet End Function Public Shared Function DoDownload_Image(ByVal faFile As String, ByVal faPath As String) As Boolean Dim vRet As Boolean = False Try Dim contenttype As String = "image/" & Path.GetExtension(faFile).Replace(".", "") Dim fs As FileStream = New FileStream(faPath & faFile, FileMode.Open, FileAccess.Read) Dim br As BinaryReader = New BinaryReader(fs) Dim bytes As Byte() = br.ReadBytes(Convert.ToInt32(fs.Length)) br.Close() fs.Close() HttpContext.Current.Response.Buffer = True HttpContext.Current.Response.Charset = "" HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache) HttpContext.Current.Response.ContentType = contenttype HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" & faFile) HttpContext.Current.Response.BinaryWrite(bytes) HttpContext.Current.Response.Flush() HttpContext.Current.Response.End() vRet = True Catch ex As Exception vRet = False Finally 'doNothing End Try Return vRet End Function VB.Net, Reading text from most common document formats like .txt, .doc, .xls, .pdf and web pages like (.html, .aspx, .jsp, .php .etc)Reading text from different files format may give directions to most of the challenges faced for building various tools like site search engine. Once you are able to extract texts, coding of very simple logic will be sufficient to design hundreds of web and window based tools. Here in this article, I am using itextsharp.dll apart from .NET and COM libraries. You need the following binaries. iTextSharp is a free binary. All other are from Miscrosoft and should be used as per Miscrosoft guidelines. If you have MS Office installed in you system you don't need these binaries. You can simply add COM reference of MS Word and MS Excel object libraries. Interop.Excel.dll for .Net 2.0 (download attachment | download from original link) Interop.Word.dll for .Net 2.0 (download attachment | download from original link) Interop.Office.dll for .Net 2.0 (download attachment | download from original link) Interop.VBIDE.dll for .Net 2.0 (download attachment | download from original link) iTextSharp for .Net 2.0 (download attachment | download from original link) '''''Code Begins herefrom Imports System.IO Imports System.Data Imports System.Xml Imports System.Text Imports System.Diagnostics Imports Microsoft.VisualBasic Imports System.Text.RegularExpressions Imports iTextSharp.text.pdf Imports System.Windows.Forms Public Function ReadText_TXT(ByVal faPath As String) As String Dim vRet As String = "" Dim vStreamReader As StreamReader = File.OpenText(faPath) Try vRet = vStreamReader.ReadToEnd() vStreamReader.Close() Catch ex As Exception vRet = "" End Try Return vRet End Function Public Function ReadText_DOC(ByVal faPath As String) As String Dim vRet As String = "" Dim vRTB As New RichTextBox Dim vWD As New Word.Application vWD.Documents.Open(faPath) vWD.Selection.WholeStory() vWD.Selection.Copy() vRTB.Paste() vRet = vRTB.Text vWD.Quit() DoGarbageCollection(vWD) Return vRet End Function Public Function ReadText_XLS(ByVal faPath As String) As String Dim vRet As String = "" Dim vRTB As New RichTextBox Dim vXL As New Excel.Application Dim vWB As Excel.Workbook = Nothing Dim vWS As Excel.Worksheet = Nothing Dim vUR As Excel.Range = Nothing Dim vCnt As Integer Dim vCtr As Integer Dim vRow As Integer Dim vCol As Integer Dim vRows As Integer Dim vCols As Integer vWB = vXL.Workbooks.Open(faPath) vXL.Calculation = Excel.XlCalculation.xlCalculationManual vXL.AlertBeforeOverwriting = False vCnt = vWB.Worksheets.Count For vCtr = 1 To vCnt vWS = vWB.Worksheets(vCtr) vUR = vWS.UsedRange vRows = vUR.Rows.Count vCols = vUR.Columns.Count For vRow = 1 To vRows For vCol = 1 To vCols vRet = vRet & CType(vUR.Cells(vRow, vCol), Excel.Range).Value & " " Next vCol Next vRow Next vWB.Close(False) DoGarbageCollection(vWB) vXL.Quit() DoGarbageCollection(vXL) Return vRet End Function Public Function ReadText_PDF(ByVal faPath As String, Optional ByVal faFromPageNum As Integer = 0, _ Optional ByVal faUptoPageNum As Integer = 0) As String Dim sb As New System.Text.StringBuilder() Try Dim reader As New PdfReader(faPath) Dim pageBytes() As Byte = Nothing Dim token As PRTokeniser = Nothing Dim tknType As Integer = -1 Dim tknValue As String = String.Empty If faFromPageNum = 0 Then faFromPageNum = 1 End If If faUptoPageNum = 0 Then faUptoPageNum = reader.NumberOfPages End If If faFromPageNum > faUptoPageNum Then Throw New ApplicationException("Err: faFromPageNum > faUptoPageNum") End If For i As Integer = faFromPageNum To faUptoPageNum Step 1 pageBytes = reader.GetPageContent(i) If Not IsNothing(pageBytes) Then token = New PRTokeniser(pageBytes) While token.NextToken() tknType = token.TokenType() tknValue = token.StringValue If tknType = PRTokeniser.TK_STRING Then sb.Append(token.StringValue) ElseIf tknType = 1 AndAlso tknValue = "-600" Then sb.Append(" ") ElseIf tknType = 10 AndAlso tknValue = "TJ" Then sb.Append(" ") End If Application.DoEvents() End While End If Next i sb = New StringBuilder(sb.ToString) Catch ex As Exception Return String.Empty End Try Return sb.ToString() End Function Public Function ReadText_WEB(ByVal faUrl As String) As String Dim vRet As String = "" Try Dim vSNWebClient As System.Net.WebClient Dim vUTF8Encoding As UTF8Encoding vSNWebClient = New System.Net.WebClient() vUTF8Encoding = New UTF8Encoding() vRet = vUTF8Encoding.GetString(vSNWebClient.DownloadData(faUrl)) Catch ex As Exception vRet = "" End Try Return ReadText_HTM(vRet) End Function Private Sub DoGarbageCollection(ByVal faObj As Object) Try Runtime.InteropServices.Marshal.ReleaseComObject(faObj) Catch Finally faObj = Nothing End Try End Sub Private Function ReadText_HTM(ByVal faContent As String) As String Dim vRet As String = faContent Try Dim vRegEx As Regex vRegEx = New Regex("", RegexOptions.IgnoreCase) vRet = Regex.Replace(vRet, "<(select|option|script|style|title)(.*?)>((.|\n)*?)</(select|option|script|style|title)>", " ", RegexOptions.IgnoreCase) vRet = Regex.Replace(vRet, "&(nbsp|quot|copy);", "") vRet = Regex.Replace(vRet, "<([\s\S])+?>", " ", RegexOptions.IgnoreCase) vRet = Regex.Replace(vRet, "\W", " ") Catch ex As Exception vRet = "" End Try Return Trim(vRet) End Function VB.Net, Working with FTPFTP Transfers files to and from a computer running a File Transfer Protocol (FTP) server service such as Internet Information Services. Ftp can be used interactively or in batch mode by processing ASCII text files. The following codes illustrates how to do the related operations programatically using VB.Net environment. Imports System.IO Imports System.Net Public Function doActionFTP_GetFileList( _ ByVal FullFtpUrl As String, Optional ByVal Usr As String = "", _ Optional ByVal Pwd As String = "" _ ) As String Dim vDirList As String = "" Try Dim fwreqObj As FtpWebRequest = DirectCast(WebRequest.Create(FullFtpUrl), FtpWebRequest) fwreqObj.Method = WebRequestMethods.Ftp.ListDirectoryDetails fwreqObj.Credentials = New NetworkCredential(Usr, Pwd) Dim fwresObj As FtpWebResponse = DirectCast(fwreqObj.GetResponse(), FtpWebResponse) Dim srObj As New StreamReader(fwresObj.GetResponseStream, System.Text.Encoding.ASCII) vDirList = srObj.ReadToEnd Catch ex As Exception vDirList = "" End Try Return vDirList End Function Public Function doActionFTP_GetFileCrDate( _ ByVal FullFtpUrl As String, _ Optional ByVal Usr As String = "", _ Optional ByVal Pwd As String = "" _ ) As Date Dim fcDate As Date = Now Try Dim fwreqObj As FtpWebRequest = DirectCast(WebRequest.Create(FullFtpUrl), FtpWebRequest) fwreqObj.Method = WebRequestMethods.Ftp.GetDateTimestamp fwreqObj.Credentials = New NetworkCredential(Usr, Pwd) Dim fwresObj As FtpWebResponse = DirectCast(fwreqObj.GetResponse(), FtpWebResponse) fcDate = fwresObj.LastModified Catch ex As FileNotFoundException fcDate = DateValue("15-AUG-1947") Catch ex As Exception fcDate = DateValue("26-JAN-1951") End Try Return fcDate End Function Public Function doActionFTP_Upload( _ ByVal FullFilePath As String, _ ByVal FullFtpUrl As String, _ Optional ByVal Usr As String = "", _ Optional ByVal Pwd As String = "" _ ) As Boolean Try Dim fwreqObj As FtpWebRequest = DirectCast(WebRequest.Create(FullFtpUrl), FtpWebRequest) fwreqObj.Method = WebRequestMethods.Ftp.UploadFile fwreqObj.Credentials = New NetworkCredential(Usr, Pwd) Dim byteObj As Byte() = File.ReadAllBytes(FullFilePath) fwreqObj.ContentLength = byteObj.Length Dim sObj As Stream = fwreqObj.GetRequestStream() sObj.Write(byteObj, 0, byteObj.Length) sObj.Close() Dim fwresObj As FtpWebResponse = DirectCast(fwreqObj.GetResponse(), FtpWebResponse) fwresObj.Close() Catch ex As Exception vRet = False Finally 'do nothing End Try Return vret End Function Public Function doActionFTP_Dnload( _ ByVal FullFtpUrl As String, _ ByVal FullFilePath As String, _ Optional ByVal Usr As String = "", _ Optional ByVal Pwd As String = "" _ ) As Boolean Dim vRet As Boolean = False Try Dim fwreqObj As FtpWebRequest = DirectCast(WebRequest.Create(FullFtpUrl), FtpWebRequest) fwreqObj.Method = WebRequestMethods.Ftp.DownloadFile fwreqObj.Credentials = New NetworkCredential(Usr, Pwd) Dim fwresObj As FtpWebResponse = DirectCast(fwreqObj.GetResponse(), FtpWebResponse) Dim sObj As Stream = fwresObj.GetResponseStream() Dim rObj As New StreamReader(sObj) Dim fsObj As New FileStream(FullFilePath, FileMode.Create) Dim wObj As New StreamWriter(fsObj) wObj.Write(rObj.ReadToEnd) wObj.Flush() wObj.Close() fsObj.Close() rObj.Close() sObj.Close() fwresObj.Close() vret = True Catch ex As Exception vRet = False Finally 'do nothing End Try Return vret End Function »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com
Embedding google maps into web pages
Sample Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google Maps JavaScript API Example: Simple Map</title> <script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg&sensor=true_or_false" type="text/javascript"></script> <script type="text/javascript"> function initialize() { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(20,77), 3); map.setUIToDefault(); } </script> </head> <body onload="initialize()" onunload="GUnload()" leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0> <div id="map_canvas" style="width: 600px; height: 450px"></div> </body> </html> JavaScript, Browser compatibility for getElementByIdBrowser detection is one of the most common scripting task that we face. The variety of different strategies in use for detecting browsers is unlimited. Here in this article I am not going to discuss it in details. Rather I am giving the following example that will help you to identified the HTML object independent of browsers. Instead of using the method getElementById in your javascript code you use getObjectById("elementname"). Please Find the following code function getObjectByID(faObj){ if (window.document[faObj]) { return window.document[faObj]; } if (document.embeds[faObj]){ return document.embeds[faObj]; } if (document.getElementById(faObj)){ return document.getElementById(faObj); } } »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com
Short Story ... Is your life worth saving?A boy was drowning in a river and he shouted for help. A man passing by jumped in the river and saved the boy's life. As the man was leaving the boy said, Thank-you.'' The man asked, "For what?" The boy replied, "For saving my life." The man looked into the boy's eyes and said, "Upon, make sure when you grow up that your life was worth saving." by Shiv Khera { You Can Win } Short Story ... Meaningless goalsA farmer had a dog who used to sit by the roadside waiting for vehicles to come around. As soon as one came he would run down the road, barking and trying to overtake it. One day a neighbor asked the farmer "Do you think your dog is ever going to catch a car?" The farmer replied, "That is not what bothers me. What bothers me is what he would do if he ever caught one." Many people in life behave like that dog who is pursuing meaningless goals. by Shiv Khera { You Can Win } Add-Ins Visible only to the user who installs Visual BasicA user who has not installed Visual Basic cannot see any Add-Ins in the Add-In dialog in Visual Basic. The reason is that Visual Basic retrieves available Add-Ins based on the CurrentUser Settings in the Registry. To resolve the issue the Add-Ins need to be registered for each user. You can refer http://support.microsoft.com/?id=190212 for variously possibilities on registering add-ins. If you have installed Visual Basic / Visual Studio at its default location then you can try the following scripts. Either you copy these codes and paste into ms-dos command prompt or you can use it as a ms-dos batch file. "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\PDWizard\PDADDIN.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\CTRLWIZ.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\AXDOCWIZ.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\AITOOL.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\APPWIZ.OCX" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\CLSSBLD.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\DATAFORM.OCX" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\MSDATOBJ.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\PROPPGWZ.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\RESEDIT.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\TEMPMGR.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\vb98\Wizards\WIZMAN.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\Common\Tools\VCM\VCMMGR.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\Common\Tools\VS-Ent98\vmodeler\RVBADDIN.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\Common\Tools\VS-Ent98\vmodeler\RVBADDINMENUS.DLL" "%systemroot%\system32\regsvr32.exe" "%programfiles%\microsoft visual studio\Common\Tools\VS-Ent98\vmodeler\RVBRESO.DLL" »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com Short Story ... Activity is Not the Same as AccomplishmentThere is a big difference between activity and accomplishment. This was demonstrated by a French scientist named Fable. He conducted an experiment with processionary caterpillars. Caterpillars follow the one in front of them blindly. Fable arranged them in a circle in a flowerpot so that the lead caterpillar actually was behind the last one forming a circle. He put pine needles (food for the caterpillars) in the center of the flowerpot. The caterpillars kept going in a circle in the pot. Eventually, after a week of circling around, they dropped dead of exhaustion and starvation with food only inches away from them. We need to learn a lesson from the caterpillars. Just because you are doing something, doesn't mean you are getting anywhere. One must evaluate one's activity in order to have accomplishment. A man was out driving with his wife and the wife said, "Honey, we are going the wrong way." The husband replied, "Who cares, we are making great time!" If we confuse activity with accomplishment, we could be making great time but we won't get anywhere. by Shiv Khera { You Can Win } Short Story ... Life is like a hot chocolateA group of graduates, well established in their careers, were talking at a reunion and decided to go visit their old university professor, now retired. During their visit, the conversation turned to complaints about stress in their work and lives. Offering his guests hot chocolate, the professor went into the kitchen and returned with a large pot of hot chocolate and an assortment of cups - porcelain, glass, crystal, some plain looking, some expensive, some exquisite - telling them to help themselves to the hot chocolate. When they all had a cup of hot chocolate in hand, the professor said: "Notice that all the nice looking, expensive cups were taken, leaving behind the plain and cheap ones. While it is normal for you to want only the best for yourselves, that is the source of your problems and stress. The cup that you're drinking from adds nothing to the quality of the hot chocolate.. In most cases it is just more expensive and in some cases even hides what we drink. What all of you really wanted was hot chocolate, not the cup; but you consciously went for the best cups... And then you began eyeing each other's cups. LIFE IS THE HOT CHOCOLATE; YOUR JOB, MONEY AND POSITION IN SOCIETY ARE THE CUPS. They are just tools to hold and contain life. The cup you have does not define, nor change the quality of life you have. Sometimes, by concentrating only on the cup, we fail to enjoy the hot chocolate God has provided us. God makes the hot chocolate, man chooses the cups. The happiest people don't have the best of everything. They just make the best of everything that they have. Live simply. Love generously. Care deeply. Speak kindly. And enjoy your hot chocolate. by Unknown Embedding live music through live FM RadioTo embed media into web pages requires a player and a source file that is to be played. Incase of live multi-media resources it has to come through web-services. The code given here is streaming the media from punjabijunction.com and the plug-in is from microsoft.com. To listen the audios just click the play button if you have disabled the autostart features. It will start playing music from Radio City Live. And if you want the same at your web pages put this code into you HTML code. <object id="MediaPlayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" type="application/x-oleobject" height="50" standby="Loading Windows Media Player components..." width="270" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"> <param NAME="filename" VALUE="http://www.punjabijunction.com/ch_radiocity/RadioCity.asx"> <param NAME="autoStart" VALUE="false"> <param NAME="TransparentAtStart" VALUE="false"> <param NAME="AnimationatStart" VALUE="false"> <param NAME="ShowStatusBar" VALUE="true"> <param NAME="ShowControls" VALUE="true"> <param NAME="autoSize" VALUE="false"> <param NAME="displaySize" VALUE="false"> <param NAME="ShowAudioControls" VALUE="true"> <param NAME="ShowPositionControls" VALUE="false"> <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="http://www.punjabijunction.com/ch_radiocity/RadioCity.asx" width="270" height="50" transparentatstart="0" autostart="1" animationatstart="0" showcontrols="true" showaudiocontrols="1" showpositioncontrols="0" autosize="0" showstatusbar="1" displaysize="false"></embed> </object> »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com Short Story ... Why are Goals Important?On the best sunny day, the most powerful magnifying glass will not light paper if you keep moving the glass. But if you focus and hold it, the paper will light up. That is the power of concentration. A man was traveling and stopped at an intersection. He asked an elderly man, "Where does this road take me?" The elderly person asked, "Where do you want to go?" The 150 of 150 man replied, "I don't know." The elderly person said, "Then take any road. What difference does it make?" How true. When we don't know where we are going, any road will take us there. Supposing you have the football eleven enthusiastically ready to play the game, all charged up, and then someone took the goal post away. What would happen to the game? There is nothing left. How do you keep score? How do you know you have arrived? Enthusiasm without direction is like wildfire and leads to frustration. Goals give a sense of direction. Would you sit in a train or a plane without knowing where it was going? The obvious answer is no. Then why do people go through life without having any goals? by Shiv Khera { You Can Win } Asp.Net, Most useful binaries for working with .Net 2.0Asp.Net 2.0 Ajax Extensions 1.0 (download attachment | download from original link) Asp.Net Ajax enables developers to choose their preferred method of Ajax development, whether it is server-side programming, client-side programming, or a combination of both for building highly interactive and responsive web applications that work across all popular browsers. The UpdatePanels and a ScriptManager will solve all your partial post-back problems. Asp.Net 2.0 Ajax Validators (download attachment | download from original link) Asp.Net 2.0 Ajax Extensions 1.0 has got some bugs while using validators. At first instant validation control will do its work but thereafter it won’t fire. Here we need the binary validators.dll. It also requires the following configurations in your web.config file. <system.web> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> <tagMapping> <add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Microsoft.Web.UI.Compatibility.CompareValidator, Validators"/> <add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Microsoft.Web.UI.Compatibility.CustomValidator, Validators"/> <add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Microsoft.Web.UI.Compatibility.RangeValidator, Validators"/> <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Microsoft.Web.UI.Compatibility.RegularExpressionValidator, Validators"/> <add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Microsoft.Web.UI.Compatibility.RequiredFieldValidator, Validators"/> <add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Microsoft.Web.UI.Compatibility.ValidationSummary, Validators"/> </tagMapping> </pages> ... </system.web> Asp.Net 2.0 AjaxControlToolkit (download attachment | download from original link) If you are not interested to write your own web user controls, this is where your struggle ends. Add a new tab to your toolbox and AjaxControlToolkit.dll will be included to your bin folder and then a number of Ajax control will be yours. FusionCharts for Asp.Net (download attachment | download from original link) FusionCharts Enterprise Edition are really world-class solutions for web based charting solutions. It has been compatible with all the web technology and has got wider usage with PHP, ASP, .NET, JSP, ColdFusion, JavaScript, Ruby on Rails etc. iTextSharp for .Net (download attachment | download from original link) It is the most useful free binary that provides most of the features you aspect for PDF files. Yes creation of PDF file from within a browser and Reading the text from the PDF file like of operations are nicely handled. Winthusiasm HtmlEditor for Asp.Net 2.0 (download attachment | download from original link) If you are looking for an Ajax enable HtmlEditor control then this is an answer to your search. Most of the required functionalities are covered here in this. It is much better than most of the paid version of such type of controls MySql Connector for .Net 2.0 (download attachment | download from original link) MySql is an answer to most of the database related challenges. From its existing MySql 5.1 onward it has been a headache for leading database solution providers. MySql.Data.dll 6.0.4 is the best solutions for your Asp.Net 2.0 applications. You can refer my article on its usage. FlashControl for .Net 2.0 (download attachment | download from original link) Embedding Flash / SWF object to any kind of web page is simple enough, but the challenge is to control these objects through server side scripts. FlashControl is the most useful dll to do such activity. Especially when you want to send some real-time data to flash object to set variables you will find these dll as most useful one. The property called FlashVars will be most attractive for you because you can then set multiple variables by setting values like "var1=value1&var2=value2&var3=value3" etc. »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com Short Story ... Keep your eyes upon the goalOn July 4, 1952, Florence Chadwick was on her way to becoming the first woman to swim the Catalina Channel. She had already conquered the English Channel. The world was watching. Chadwick fought the dense fog, bone-chilling cold and many times, the sharks. She was striving to reach the shore but every time she looked through her goggles, all she could see was the dense fog. Unable to see the shore, she gave up. Chadwick was disappointed when she found out that she was only half a mile from the coast. She quit, not because she was a quitter but because her goal was not in sight anywhere. The elements didn't stop her. She said, "I'm not making excuses. If only I had seen the land, I could have made it." Two months later, she went back and swam the Catalina Channel. This time, in spite of the bad weather, she had her goal in mind and not only accomplished it but beat the men's record by two hours. by Shiv Khera { You Can Win } CSS, Creating Visual Studio editor style of code-block using style-sheet in HTML codeA Cascading Style Sheet (CSS) contains style rules that are applied to elements in a Web page. CSS styles define how elements are displayed and where they are positioned on the page. Instead of assigning attributes to each element on your page individually, you can create a general rule that applies attributes whenever a Web browser encounters an instance of an element or an element that is assigned to a certain style class. There is nothing much descriptive on the following code. It will produce the output provided to next of the code. The output not an image rather it is text formatted through the CSS. Have a look. The HTML Code <html> <head> <title> Santosh Kumar's Tips & Tricks </title> <style> .CssDivOut{ margin:2px;border:1px solid #ACA899;background-color:#f8f8f8;width:100%; font-family:'Courier New',Courier,mono;font-size:12px;overflow:auto;max-height:400px; } .CssDivInn{ background:#FFF none repeat scroll 0 0;border-color:#999;border-style:none solid solid; border-width:medium 0px 0px;margin:0 0 0 0; overflow:auto;padding:.0 0 0 0; text-align:left;width:100%; } ol{ list-style:decimal;list-style:decimal-leading-zero;padding:0; color:#5C5C5C; background-color:#fff;margin:0 0 1px 45px; } li{ border-left:3px solid #6CE26C;margin:0; padding:0; padding-left:10px;white-space:nowrap;background-color:#f8f8f8; } </style> </HEAD> <BODY> <div class="CssDivOut"> <div class="CssDivInn"> <ol> <li>Public Function GetFileContent(ByVal faPath As String) As String</li> <li> Dim vRet As String = ""</li> <li> Dim vStreamReader As StreamReader = File.OpenText(faPath)</li> <li> Try</li> <li> vRet = vStreamReader.ReadToEnd()</li> <li> vStreamReader.Close()</li> <li> Catch ex As Exception</li> <li> vRet = ""</li> <li> End Try</li> <li> Return vRet</li> <li>End Function</li> </ol> </div> </div> </body> </html> The HTML Output »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com Short Story ... What do you seeAn ancient Indian sage was teaching his disciples the art of archery. He put a wooden bird as the target and asked them to aim at the eye of the bird. The first disciple was asked to describe what he saw. He said, "I see the trees, the branches, the leaves, the sky, the bird and its eye.." The sage asked this disciple to wait. Then he asked the second disciple the same question and he replied, "I only see the eye of the bird." The sage said, "Very good, then shoot." The arrow went straight and hit the eye of the bird. Unless we focus, we cannot achieve our goal. It is hard tofocus and concentrate, but it is a skill that can be learned. by Shiv Khera { You Can Win } Retrieving attribute values from Microsoft WMI ClassesWMI stands Windows Management Instrumentation in Microsoft Windows operating systems. It is a set of extensions to the Windows Driver Model that provides Operating System interface to provide information and notification. The following code will retrive the values from each of the properties of Win32_BIOS class This example uses instance of Win32_BIOS class and a list of class deffers dependending upon what is installed in the system. This list commonly includes classes like Win32_1394Controller, Win32_ACE, Win32_Account, Win32_AccountSID, Win32_ApplicationService, Win32_BIOS, Win32_BaseBoard, Win32_BaseService, Win32_Battery, Win32_Binary, Win32_BindImageAction, Win32_BootConfiguration, Win32_Bus, Win32_CDROMDrive, Win32_COMApplication, Win32_COMClass, Win32_COMSetting, Win32_CacheMemory, Win32_ClassInfoAction, Win32_ClassicCOMClass, Win32_ClassicCOMClassSetting, Win32_CodecFile, Win32_CommandLineAccess, Win32_ComponentCategory, Win32_ComputerSystem, Win32_ComputerSystemProduct, Win32_Condition, Win32_CreateFolderAction, Win32_CurrentProbe, Win32_DCOMApplication, Win32_DCOMApplicationSetting, Win32_DMAChannel, Win32_Desktop, Win32_DesktopMonitor, Win32_DeviceMemoryAddress, Win32_Directory, Win32_DirectorySpecification, Win32_DiskDrive, Win32_DiskPartition, Win32_DisplayConfiguration, Win32_DisplayControllerConfiguration, Win32_DriverVXD, Win32_DuplicateFileAction, Win32_Environment, Win32_EnvironmentSpecification, Win32_ExtensionInfoAction, Win32_Fan, Win32_FileSpecification, Win32_FloppyController, Win32_FloppyDrive, Win32_FontInfoAction, Win32_Group, Win32_HeatPipe, Win32_IDEController, Win32_IRQResource, Win32_InfraredDevice, Win32_IniFileSpecification, Win32_Keyboard, Win32_LaunchCondition, Win32_LoadOrderGroup, Win32_LogicalDisk, Win32_LogicalFileSecuritySetting, Win32_LogicalMemoryConfiguration, Win32_LogicalProgramGroup, Win32_LogicalProgramGroupItem, Win32_LogicalShareSecuritySetting, Win32_MIMEInfoAction, Win32_MSIResource, Win32_MemoryArray, Win32_MemoryDevice, Win32_MethodParameterClass, Win32_MotherboardDevice, Win32_MoveFileAction, Win32_NTEventlogFile, Win32_NTLogEvent, Win32_NetworkAdapter, Win32_NetworkAdapterConfiguration, Win32_NetworkClient, Win32_NetworkConnection, Win32_NetworkLoginProfile, Win32_NetworkProtocol, Win32_ODBCAttribute, Win32_ODBCDataSourceSpecification, Win32_ODBCDriverSpecification, Win32_ODBCSourceAttribute, Win32_ODBCTranslatorSpecification, Win32_OSRecoveryConfiguration, Win32_OnBoardDevice, Win32_OperatingSystem, Win32_PCMCIAController, Win32_POTSModem, Win32_PageFile, Win32_PageFileSetting, Win32_PageFileUsage, Win32_ParallelPort, Win32_Patch, Win32_PatchPackage, Win32_PhysicalMemory, Win32_PhysicalMemoryArray, Win32_PnPEntity, Win32_PointingDevice, Win32_PortConnector, Win32_PortResource, Win32_PortableBattery, Win32_PowerManagementEvent, Win32_PrintJob, Win32_Printer, Win32_PrinterConfiguration, Win32_PrivilegesStatus, Win32_Process, Win32_ProcessStartup, Win32_Processor, Win32_Product, Win32_ProgIDSpecification, Win32_ProgramGroup, Win32_ProgramGroupOrItem, Win32_Property, Win32_PublishComponentAction, Win32_QuickFixEngineering, Win32_Refrigeration, Win32_Registry, Win32_RegistryAction, Win32_RemoveFileAction, Win32_RemoveIniAction, Win32_ReserveCost, Win32_SCSIController, Win32_SID, Win32_SMBIOSMemory, Win32_ScheduledJob, Win32_SecurityDescriptor, Win32_SecuritySetting, Win32_SelfRegModuleAction, Win32_SerialPort, Win32_SerialPortConfiguration, Win32_Service, Win32_ServiceControl, Win32_ServiceSpecification, Win32_Share, Win32_ShortcutAction, Win32_ShortcutFile, Win32_ShortcutSAP, Win32_SoftwareElement, Win32_SoftwareElementCondition, Win32_SoftwareFeature, Win32_SoftwareFeatureAction, Win32_SoundDevice, Win32_StartupCommand, Win32_SystemAccount, Win32_SystemDriver, Win32_SystemEnclosure, Win32_SystemMemoryResource, Win32_SystemSlot, Win32_TapeDrive, Win32_TemperatureProbe, Win32_Thread, Win32_TimeZone, Win32_Trustee, Win32_TypeLibraryAction, Win32_USBController, Win32_UninterruptiblePowerSupply, Win32_UserAccount, Win32_VideoConfiguration, Win32_VideoController, Win32_VoltageProbe, Win32_WMISetting. More on this... The Visual Basic Code Sub Get_Win32_Information() Dim vList, vObj On Local Error Resume Next Set vList = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_BIOS") For Each vObj In vList Debug.Print "BiosCharacteristics = " & vObj.BiosCharacteristics Debug.Print "BuildNumber = " & vObj.BuildNumber Debug.Print "Caption = " & vObj.Caption Debug.Print "CodeSet = " & vObj.CodeSet Debug.Print "CurrentLanguage = " & vObj.CurrentLanguage Debug.Print "Description = " & vObj.Description Debug.Print "IdentificationCode = " & vObj.IdentificationCode Debug.Print "InstallableLanguages = " & vObj.InstallableLanguages Debug.Print "InstallDate = " & vObj.InstallDate Debug.Print "LanguageEdition = " & vObj.LanguageEdition Debug.Print "ListOfLanguages = " & vObj.ListOfLanguages Debug.Print "Manufacturer = " & vObj.Manufacturer Debug.Print "Name = " & vObj.Name Debug.Print "OtherTargetOS = " & vObj.OtherTargetOS Debug.Print "PrimaryBIOS = " & vObj.PrimaryBIOS Debug.Print "ReleaseDate = " & vObj.ReleaseDate Debug.Print "SerialNumber = " & vObj.SerialNumber Debug.Print "SMBIOSBIOSVersion = " & vObj.SMBIOSBIOSVersion Debug.Print "SMBIOSMajorVersion = " & vObj.SMBIOSMajorVersion Debug.Print "SMBIOSMinorVersion = " & vObj.SMBIOSMinorVersion Debug.Print "SMBIOSPresent = " & vObj.SMBIOSPresent Debug.Print "SoftwareElementID = " & vObj.SoftwareElementID Debug.Print "SoftwareElementState = " & vObj.SoftwareElementState Debug.Print "Status = " & vObj.Status Debug.Print "TargetOperatingSystem = " & vObj.TargetOperatingSystem Debug.Print "Version = " & vObj.Version Next End Sub The Debug.Print Output BuildNumber = Caption = BIOS Date: 06/05/02 16:58:00 Ver: 08.00.00 CodeSet = CurrentLanguage = enUS Description = BIOS Date: 06/05/02 16:58:00 Ver: 08.00.00 IdentificationCode = InstallableLanguages = 1 InstallDate = LanguageEdition = Manufacturer = Intel Corp. Name = BIOS Date: 06/05/02 16:58:00 Ver: 08.00.00 OtherTargetOS = PrimaryBIOS = True ReleaseDate = 20020605******.******+*** SerialNumber = SMBIOSBIOSVersion = LY84510A.86A.0011.P05.0206051658 SMBIOSMajorVersion = 2 SMBIOSMinorVersion = 3 SMBIOSPresent = True SoftwareElementID = BIOS Date: 06/05/02 16:58:00 Ver: 08.00.00 SoftwareElementState = 3 Status = OK TargetOperatingSystem = 0 Version = BIOS Date: 06/05/02 16:58:00 Ver: 08.00.00 »»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com Listing all Microsoft WMI Non Associated Classes with its Methods and PropertiesWMI stands Windows Management Instrumentation in Microsoft Windows operating systems. It is a set of extensions to the Windows Driver Model that provides Operating System interface to provide information and notification. The following code will list the entire non-associated class name and their method name along with property name. This code will help to find those keywords that can be used for further WNI scripting The Visual Basic Code Sub Get_Win32_Classdetail() vStrComp = "." Set vObjWmiService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & vStrComp & "\root\cimv2") For Each vObjAllClass In vObjWmiService.SubclassesOf() vIsAssociated = 0 If Left(vObjAllClass.Path_.Class, 5) = "Win32" Then For Each Qualifier In vObjAllClass.Qualifiers_ If LCase(Trim(Qualifier.Name)) = "association" Then vIsAssociated = 1 Exit For End If Next If vIsAssociated = 0 Then Debug.Print vObjAllClass.Path_.Class Set vObjCurClass = vObjWmiService.Get(vObjAllClass.Path_.Class) Debug.Print vbTab & "Properties" For Each vObjItem In vObjCurClass.properties_ Debug.Print vbTab & vbTab & vObjItem.Name Next Debug.Print vbTab & "Methods" For Each vObjItem In vObjCurClass.methods_ Debug.Print vbTab & vbTab & vObjItem.Name Next Debug.Print End If End If Next End Sub The Debug.Print Output
»»»»»»» by Santosh Kumar ? Original @ http://santu4you.spaces.live.com |
|
|