Posts

Get the Values of all SPAN Elements with the same Class Name using jQuery

I am using the snippet below on one of my blogs in blogger to dynamically get the classname of a span element which contains a text of the post ID of the entry and process the iframe tags within that element. $(document).ready(function(){ $.each($('span.post-id'),function(i,v){ var s = $(this).text(); getiFrame(s); //this is a separate function to process iframe tags. }); });

How to Extract Data From HTML (.aspx) website into Excel using VBA

Image
In this example I used the following VBA code to extract the data stored in a script variable. You can see the example data from an HTML file at the end of this post. Below is the snapshot of the page that I was trying to extract data from. VBA CODE: '******************************************************** ' DESCRIPTION: GET DATA FROM TABLE OF A .ASPX WEBSITE ' BY: CROMWELL D. BAYON ' EMAIL: OMELSOFT@GMAIL.COM '******************************************************** Sub GetOfflineData() Dim file As String, Data As String Dim delimQ As String Dim lineContentLoc As Long delimQ = Chr(34) file = Application.ActiveWorkbook.Path & "\Source of Select.html" Open file For Input As #1 Do Until EOF(1) Line Input #1, linefromfile 'Check only the line containing this pattern (var best_idear_data =[) If InStr(1, linefromfile, "var best_idear_data =[...

Count number of occurrence in a string using Excel VBA.

The following code snippet allows you to get the number of text occurrences in a string using VBA in Excel. Function StringCountOccurrences(strText As String, strFind As String, _                                 Optional lngCompare As VbCompareMethod) As Long Dim lngPos As Long Dim lngTemp As Long Dim lngCount As Long     If Len(strText) = 0 Then Exit Function     If Len(strFind) = 0 Then Exit Function     lngPos = 1     Do         lngPos = InStr(lngPos, strText, strFind, lngCompare)         lngTemp = lngPos         If lngPos > 0 Then             lngCount = lngCount + 1             lngPos = lngPos + Len(strFind)         End If     Loop Until lngPos = 0     StringCountOccurrences = lngCount End Functi...

How to detect Scroll position of a webpage using jQuery's .scrollTop()

The .scrollTop() function in jQuery allows you to get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. You can extract the scroll position of a certain page or element using the jQuery's .scrollTop() method . $(window).scroll(function (event) { var scroll = $(window).scrollTop(); // Do something }); You can also determined the percentage and alert the user that he has scrolled certain amount within the document. >$(document).scroll(function(e){ // get the scroll value and the document height var scrollVal = $(window).scrollTop(); var docHeight = $(document).height(); // calculate the percentage when the user scrolls down the page var percentage = (scrollVal / docHeight) * 100; if(percentage > 50) { // call the function called alertUser alertUser(percentage); } function alertUser(scr...

How to Add an Adsense Code Manually into Blogger Template

Image
In this article you'll be able to learn on how to Add an AdSense Code manually into blogger template. If you have an AdSense Account and wanted to setup a blog using blogger. You can however incorporate your approved email account with AdSense in which blogger creates the widget and automatically insert your adcode in between, before or after each posts. You can find anywhere in the web on how to do this thing but here I'm going to give you the instructionswith ease. Let's take a look at the layout below. What we're going to do is put an AdSense code in the green square with "your add here" caption. And we only wanted it to appear on items and or blog posts. 1 On your Blogger's dashboard, Click the Template  then Click "Edit HTML" . 2 Click anywhere on the Template editor window and Press Ctrl+F  then type the following b:widget id='Blog1' in the search box and press Enter. You should see similar to the image below. Within the ...

VB.Net Print PDF Document

Image
Portable Document Format ( PDF ) is a file format used to present documents in a manner independent of application software, hardware, and operating systems. Each PDF file encapsulates a complete description of a fixed-layout flat document, including the text, fonts, graphics, and other information needed to display it. In some applications, web or desktop there are several options where you can convert or Print a PDF version of a form or document you're reading. So, the question is how is it done and is it possible to create your own PDF document from scratch? We'll you're still lucky as I am. In this tutorial you'll be able to learn on how can VB.Net Print PDF Documents . Requirements 1.) CodePlex.com provides a freely downloadable version of the PDFSharp-MigraDocFoundation-Assemblies . 2.) Extract the downloaded .zip file to your project folder. The file name if not updated is PDFsharp-MigraDocFoundation-Assemblies-1_31.zip. Creating the Project 1.) S...

Formatting Date and Time VB.NET

The Date literal must be enclosed within number signs ( #date# ) and specify the date value in the format M/d/yyyy like #09/06/2014# . Else, the way how your code is interpreted may vary depending on the locale in which your application is deployed. With this requirement the meaning of your code should never change whether if it has a different date and time format settings. For example, you hard-coded a Date literal of #9/6/2014# which means September 6, 2014. That will compile 9/6/2014 as you want mm/dd/yyyy. However, if you deploy application in several locales using dd/mm/yyyy date format, your hard-coded literal would compile to June 9, 2014. For other locales using yyyy/mm/dd, the literal would be invalid causing compilation error. To convert a Date literal to the format of your locale or to a custom format, use the Format function of String class, specifying either a predefined or user-defined date format. Predefined Date/Time Formats The following table identifies the ...