Friday, May 21, 2010

XMLDOM for IE and FF

if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("condos.xml");
}
else {
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.load("condos.xml");
}

Wednesday, November 19, 2008

Import from excel

xlFilePath = workspace.OpenFileDialog( False, "Please select the excel file ","*.xls", "d:")

If Isempty(xlFilePath) Then

Exit Sub

End If
Set varExcel = CreateObject( "Excel.Application" )

varExcel.Visible = False ' Making the selected Excel invisible

varExcel.Workbooks.Open xlFilePath '// Open the Excel file

Set xlWorkbook = varExcel.ActiveWorkbook

Set xlSheet = xlWorkbook.ActiveSheet

intExcelRow= 2 ' The excel file content starts from 2 always
'Processing the Excel row and sending an email

Print "Upload process started......."

While (xlSheet.cells(intExcelRow, 1).value <> "" )

With xlSheet

strExcelRepID = Cstr (.Cells( intExcelRow, 1).Value) '

strExcelFilename = Cstr (.Cells( intExcelRow, 2).Value)

End With

intExcelRow = intExcelRow +1

Print "Row Number -- " + Cstr (intExcelRow)

Wend

Monday, September 1, 2008

Probelm after installing SP3 for Excel 2003.

After installing SP3 for Excel 2003, I'm not able to open Lotus 1-2-3 files. When I try to open/save a .wk3 or .wk4 file we get the following error."You are attempting to open a file type that is blocked by your registry policy setting".When I googled for the above problem, I landed in Microsoft site. The below extract is from Microsoft site.

Excel 2003
loadTOCNode(2, 'moreinformation');
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/) How to back up and restore the registry in WindowsAn administrator can restrict the types of files that you can open in Excel 2003. This ability was not provided in Microsoft Office 2003 when it was originally released. To restrict the types of files that can be opened in Excel 2003, install security update 933666.For more information about security update 933666, click the following article number to view the article in the Microsoft Knowledge Base:
933666 (http://support.microsoft.com/kb/933666/) Description of the security update for Excel 2003: May 8, 2007 To restrict the types of files that you can open in Excel 2003, an administrator can use one of the following methods:

Use the updated Office 2003 Administrative Templates to configure the registry on the client computer.

Modify the registry by adding a registy key setting on the client computer. To download the Office 2003 Service Pack 3 Administrative Template (ADM), OPAs, and Explain Text Update, visit the following Microsoft Web site:
http://www.microsoft.com/downloads/details.aspx?familyid=BA8BC720-EDC2-479B-B115-5ABB70B3F490&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=BA8BC720-EDC2-479B-B115-5ABB70B3F490&displaylang=en)The following table contains the DWORD names that an administrator can add to the registry to restrict certain file types by using the FileOpenBlock subkey. Additionally, the table contains the corresponding file types that are restricted.
DWORD name
File types that are restricted
BinaryFiles
.xls, .xla, .xlt, .xlm, .xlw, .xlb
HtmlandXmlssFiles
.mht, .mhtml, .htm, .html, .xml, .xmlss
XmlFiles
.xml
DifandSylkFiles
.dif, .slk
TextFiles
.txt, .csv, .prn
XllFiles
.xll
Converters
All file formats that are available by using a text converter (including the Office Compatibility Pack)
DatabaseandDatasourceFiles
.odc, .udl, .dsn, .dbc, .dqy, .iqy, .oqy, .rqy, .mde, .mdb, .dbf, .ade, .adp, .cub
LotusandQuattroFiles
.wk1, .wk4, .wj3, wk1 FMT, .wks, .wk3, wk3 FM3, .wj2, .wq1, .fm3, .wj1
LegacyBinaryFiles
Microsoft Excel 4.0 Charts (.xlc) files (Office 2003 SP3)
LegacyDatabaseAndDatasourceFiles
DBF 2 (dBASE II) (.dbf) files (Office 2003 SP3)To enable the FileOpenBlock subkey settings, follow these steps:
1.
Exit Excel.
2.
If you are running Excel 2003, install security update 933666 if it is not installed, and then go to step 3. If you are running Excel 2007, go to step 3.
3.
Click Start, click Run, type regedit in the Open box, and then click OK.
4.
Locate and then click to select one of the following registry subkeys: Excel 2007
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security\FileOpenBlock HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Excel\Security\FileOpenBlockExcel 2003
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security\FileOpenBlock HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\11.0\Excel\Security\FileOpenBlockIf the FileOpenBlock subkey does not exist, follow these steps to create it:
a.
Click to select the Security subkey.
b.
On the Edit menu, point to New, and then click Key.
c.
Type FileOpenBlock, and then press ENTER.
5.
Point to New on the Edit menu, and then click DWORD Value.
6.
Type the DWORD name that you want to restrict, and then press ENTER. For example, type BinaryFiles.
7.
Right-click the DWORD name that you typed in step 6, and then click Modify.
8.
In the Value data box, type 1, and then click OK.
9.
On the File menu, click Exit to exit Registry Editor.For more information, click the following article number to view the article in the Microsoft Knowledge Base:
945797 (http://support.microsoft.com/kb/945797/) You receive an error message when you try to save a file type that was blocked by your registry policy settings in Excel 2007 or in Excel 2003

For full details check here http://support.microsoft.com/kb/922848/

Thursday, August 7, 2008

Saturday, July 12, 2008

NNOTESWS.DLL - Notes Progress Bar


Yet another API code. Through this code we can bring the native notes progress bar to our application.


Sub Click(Source As Button)
Dim pb As New LNProgressBar(False)
Dim i As Long


For i=1 To 1000
'we process the elements
Call pb.SetText(Cstr(i)+" Sample Progress Bar","")
Call pb.SetProgressPos(i)
Next
'Terminate the progress bar
Delete pb
End Sub
The below code in the decalration event:
Declare Function NEMProgressBegin Lib "nnotesws.dll" ( Byval wFlags As Integer ) As Long
Declare Sub NEMProgressDeltaPos Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwIncrement As Long )
Declare Sub NEMProgressEnd Lib "nnotesws.dll" ( Byval hwnd As Long )
Declare Sub NEMProgressSetBarPos Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwPos As Long)
Declare Sub NEMProgressSetBarRange Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwMax As Long )
Declare Sub NEMProgressSetText Lib "nnotesws.dll" ( Byval hwnd As Long, Byval pcszLine1 As String, Byval pcszLine2 As String )
Const NPB_TWOLINE = 3
Const NPB_ONELINE = 2
Class LNProgressbar
hwnd As Long
Sub New(SecondLineVisible As Integer)
'Set-up the progress bar on the screen
If SecondLineVisible Then
hwnd = NEMProgressBegin(NPB_TWOLINE)
Else
hwnd = NEMProgressBegin(NPB_ONELINE)
End If
End Sub
Sub SetText(FirstLineText As String,SecondLineText As String)
'Display the text in progress bar
NemProgressSetText hwnd, FirstLineTExt,SecondLineText
End Sub
Sub SetProgressPos(Progresspos As Long)
NEMProgressSetBarPos hwnd, ProgressPos
End Sub
Sub SetProgressRange(ProgressMaxElements As Long)
'Set-up the max elements in the progress bar, if you have
'a list with 230 elements then set the MAX to 230 elements.
'For every element you proceed increase the SetProgressPos
'by one to reached 230
NEMProgressSetBarRange hwnd, ProgressMaxElements
End Sub
Sub DeltaPos(DPos As Long)
' This function adds the number in DPOS to the current ProgressPos
NEMProgressDeltaPos hwnd, DPos
End Sub
Sub Delete
'Terminate the progress bar on the screen
NEMProgressEnd hwnd
End Sub
End Class

Monday, June 16, 2008

Rich Text attachment processing

Rich text validation:
If we want to process the attachments in a rich text field we normally use the following code
"Forall o In rtitem.EmbeddedObjects"
How ever, if there are no attachments in the field then we get type mismatch error. To avoid it we can use the following condition before the above code
"If Not Isempty(rtitem.EmbeddedObjects) Then
Forall o In rtitem.EmbeddedObjects
End forall
End If"

Wednesday, June 4, 2008

Technical Articles - 3: Web 2.0

Web2.0. We come across this word now and then in the Internet. When ever a CTO or some big head gives a talk, at least once he/she will use this word. What is Web 2.0?. Do we have any thing like Web1.0 and web 3.0?

The term Web2.0 became notable after the first O'Reilly Media Web 2.0 conference in 2004. According to them web2.0 stands for ,
"Web 2.0 is the business revolution in the computer industry caused by the move to the Internet as platform, and an attempt to understand the rules for success on that new platform".

Here is an another definition for web 2.0 from First Monday.
"Web 2.0 represents a blurring of the boundaries between Web users and producers, consumption and participation, authority and amateurism, play and work, data and the network, reality and virtuality. "

So, Web 2.0 is a not a technology but a way of designing applications. We cannot even call it as a way of programming.

Returning back to O'Reillys statement,
Mr. O’Reilly characterized Web 1.0 through a set of static, one–way browser–based applications like personal Web sites and the encyclopedia Britannica Online, publishing, content management systems, and taxonomies. Subsequently, he distinguished Web 2.0 by associating it with the “new participatory architectures of the Web” that allow for online services such as the photo sharing site Flickr, blogs, the peer–to–peer file sharing standard BitTorrent, Wikipedia, event sites like Upcoming.org, the file–sharing service Napster, wikis (collaborative Web sites that allow for real–time editing), folksonomies (user–generated taxonomies), and the aggregation of online content through Web feeds.

The definition morphed considerably over time. Late in 2005 O’Reilly wrote that:
"Web 2.0 is the network as platform, spanning all connected devices; Web 2.0 applications & [are] delivering software as a continually–updated service that gets better the more people use it, consuming and remixing data from multiple sources, including individual users, while providing their own data and services in a form that allows remixing by others, creating network effects through an ‘architecture of participation,’ and & deliver rich user experiences."


According to MichelZimmer's article in First Monday,
"Which technologies are commonly collected under the Web 2.0 umbrella? Evangelists of the phrase huddle technologies like the Web development technique Ajax , the Ruby programming language, CSS, RSS, OpenAPIs, wikis, blogs, mashups (digital media works that draw from already existing texts or audio), and podcasts (media files that are distributed over the Internet to be played back on portable media players) under its roof. They highlight user–friendly interfaces, activities like tagging, social networking and microformats as Web 2.0 descriptors"

To put it in my words, there is no restriction that only a particular set of technology can be used for web2.0.

(To be Continued)