Showing posts with label Tech. Show all posts
Showing posts with label Tech. Show all posts

May 30, 2008

High scalable architectures

Last week I came across interesting web site by Todd Hoff who was former IBM and Intuit Employee.

His site http://highscalability.com/ on high scalable architectures has some big shot web sites explaining lore, art and science behind it. Some examples are:

His personal web site is at http://possibility.com/Tmh/ and Wiki stuff is at http://www.possibility.com/wiki/index.php?title=Main_Page

April 06, 2007

Guidelines when applying color in diagrams

Without a doubt, the use of color dramatically impacts any diagram or presentation. You can use color to draw attention to particular aspects of a diagram, to distinguish differences between elements, or simply to increase the visual appeal. When misused, however, color can cause discomfort to the viewer and even create ambiguity. Discover some of the common mistakes modelers can make when applying color to diagrams, and learn a set of simple rules you can follow when presenting model information containing color.

This article on Using color effectively in system models discusses how to follow simple guidelines when applying color in diagrams.

March 12, 2007

Compare Intel Processors for laptops

Got this Intel page when I was looking for specifications on Core Duo 2 processors (T5500, T5600 and LV2400)....

February 25, 2007

Some coooooooool stuff

Some cool stuff including robotics / R/C models and lots more can be found here.

And some more geek stuff for kids (and us) can be found here...

February 16, 2007

Thoughtworks opensource projects

http://opensource.thoughtworks.com/projects/index.html

Projects
Listed here are the open source projects that ThoughtWorkers contribute to, grouped by function.
Build & Continuous Integration
Ant
Ant is the standard Java build tool
Buildix
Buildix is a version of Linux that contains a ready to go collaboration environment for development teams
CruiseControl
CruiseControl is a framework for a continuous build process written in Java
CruiseControl.NET
A framework for a continuous build process for .NET applications
Maven
Maven is a build and meta-project tool that goes a step beyond Ant
NAnt
A free .NET build tool that is a lot like Ant
Testing
Ashcroft
A tool to help enforce best practices in unit tests
ASPUnit
ASPUnit is a unit testing framework based on the architecture of JUnit for ASP
BTSUnit
A unit testing framework for BizTalk Server 2004
COMUnit
A COM unit testing framework based on the architecture of JUnit
Dashboard
A plugin for IntelliJ IDEA and Eclipse that gives instant feedback regarding the current status of a continous integration build
DbFixture
A lightweight testing fixture framework that helps database related testing using HSQLDB.
DynaMock
One of the frameworks for building MockObjects on the fly using Java's DynamicProxy mechanism.
FitNesse
The fully integrated standalone wiki, and acceptance testing framework.
Guantanamo
A tool to hunt down and destroy bad tests and untested code
Hansel
Hansel is an extension to JUnit that adds code coverage testing to the testing framework.
hloader
A tool to aid population of Hibernate objects from an XML file for test data
JBehave
A unit testing framework for Java
Jester
Jester finds code that is not covered by tests.
jfcUnit
jfcUnit is a GUI-test tool that allows you to simulate user actions against a Java Swing UI
JMock
A Java mock objects implementation
JUnit
A regression testing framework written in Java
JUnit Addons
A collection of helper classes for JUnit
JWebUnit
An extension to HTTPUnit for testing web applications
Marathon
Marathon is a GUI-test tool that allows you to play and record scripts against a Java Swing UI
MockMaker
A tool for automated code generation of mock objects for existing Java class/interfaces
NMock
A toolkit for .NET that allows mock objects to be dynamically created at test-time
NUnit
A unit-testing framework for all .NET languages
NUnitAsp
NUnitAsp is a tool for automatically testing ASP.NET web pages.
NUnitForms
NUnitForms is an NUnit extension for unit and acceptance testing of Windows Forms applications.
OO-Matron
Experimental TDD tool
RVTest
RV Test provides a unit testing framework for TIBCO Rendezvous messaging.
Selenium
Selenium is a system testing tool for web applications
SelfEsteem
A graphical presentation of Acceptance Test results
SharpRobo
Functional Testing and Recording tool for WinForm applications written in C#
Test Simple Unit
A simplified Perl unit-testing framework
Test::Unit::Mock
A utility for conveniently building mock objects in Test::Unit
TestKit
Mock objects for the Objective-C programming language
Watir
A Ruby library that enables you to automate tests for Web applications using Internet Explorer
XMLUnit
Extensions to JUnit, NUnit and PyUnit to enable assertions to be made about generated XML content
XPath Explorer
A GUI application for XPath experiment, and a library for XML assertions through xpath
Performance
ehcache
A pure Java, in-process cache
ehcache-constructs
Implementations of common caching patterns
JBenchmark
A tool for benchmarking the performance of web applications
Ruby-MemCache
A client library for memcached, a high-performance distributed memory cache
Intregrated Development Environments
Eclipse
An IDE and framework for building GUI applications
jbuilder-opentools
A JBuilder OpenTool community
Monocle
A set of add-ins, macros, and extensions for VisualStudio.NET
Transparent
A ClearCase plugin for IntelliJ
Presentation Layer
Apache MyFaces
An open source JSF implementation, and a several extensions libraries for MVC based java web applications
SiteMesh
A Java module from OpenSymphony that allows look and feel to be abstracted from a web-application
SiteMesh.NET
A .NET port of the popular OpenSymphony Sitemesh
Turbine
A servlet based framework that allows experienced Java developers to quickly build web applications.
WebWork
An MVC model 2 web framework.
Persistence Layer
iBATIS
Maps objects to SQL statements using a very simple XML descriptor (Java and .NET)
Jaxor
A simple, yet powerful tool for creating an object to relational mapping layer
JDBCFacade
JDBCFacade is a library for making JDBC easier to use and less error prone while encouraging a clean separation between persistence and domain logic
Neo
A framework for .NET developers who want to write enterprise applications with an object-based domain model
rBatis
rBatis is the Ruby port of the iBatis framework.
Torque
A persistence layer that include generator for OM/Peer classes
Prevayler
A persistence framework for Java
AOP and IoC (Dependency Injection)
AspectWerkz
A dynamic, lightweight and high-performant AOP framework for Java
Nanning
A simple yet scaleable aspect-oriented framework for Java
MicroContainer
MicroContainer is an lightweight container for self contained NanoContainer applications.
NanoContainer
a small container for Constructor Dependency Injector (CDI) Components at Codehaus, that composes components via scripts
PicoContainer
PicoContainer is a small embeddable container for Constructor Dependency Injector (CDI) Components
XWork
A command-pattern framework that is used to power WebWork
General Infrastructure
Apache Axis
A WSI Web Services implementation
BEEP for Ruby
An implementation of BEEP (Blocks Extensible Exchange Protocol) in Ruby
Enterprise Object Broker (EOB)
An alternative to EJB, bringing some of the simplicity of application serving for .Net back to Java
jTDS
100% pure Java (type 4) JDBC 2.1 driver for Microsoft SQL Server and Sybase 10
OpenSymphony
An umbrella project for component building blocks for kick-starting J2EE application development
QuickFix
QuickFix is a multi language open source API for the FIX (Financial InterXchange) protocol.
Tanga
Tanga is an alternative syntax for XML designed for certain scenarios where human readability is required.
Game Engines
Enigma
Enigma is a puzzle game inspired by Oxyd on the Atari ST and Rock'n'Roll on the Amiga.
FaerieMUD
The F?rieMUD Project is an effort to create a new MMORPG
MUES
A multi-threaded, event-driven internet game environment server written in Ruby
Quizzo
A word game quiz program written in Ruby
Utilities
Arrow
A framework for building web applications using Apache and mod_ruby
Barbecue
A Java barcode library that provides the means to create barcodes for printing and display
BlueCloth
A Ruby implementation of Markdown, a text-to-HTML conversion tool
CrossCase
A Ruby mixin for auto-generating under_barred aliases for camelCased methods
FOP
a Java application that reads a formatting object tree and renders the resulting pages to a specified output (eg. PDF, PCL, PS, etc.)
IO::Reactor
A Ruby implementation of an asynchronous multiplexed IO Reactor
JAggregate
A J2SE 5.0-aware collections library modelled after the Smalltalk collections protocol
JOpt Simple
A test-driven command line parser for Java programs
Linguistics
A generic, language-neutral framework for extending Ruby objects with linguistic methods
PluginFactory
A Ruby mixin to facilicate creating derivative classes
Rdoc
Generates documentation from Ruby source files
Ruby-ODE
A Ruby binding for the Open Dynamics Engine
Ruby-WordNet
A Ruby interface to the WordNet? Lexical Database
Test::SimpleUnit
A Perl unit-testing framework.
Win32Utils
Windows utilities for the Ruby programming language
XStream
A Java library to serialize/deserialize objects to/from XML
xwork-optional
An XWork library for handling other domains than the web, such as email, command line processing, or JMS
Web Container
Apache Tomcat
The reference implementation for the Servlet and Java Server Pages specifications
Jetty
A Java HTTP Server and Servlet Container
RSS
Aggrevator
Aggrevator is a cross-platform RSS/Atom aggregator
Informa
An RSS aggregation library based on the Java Platform
Operating System
FreeBSD
FreeBSD is an advanced operating system for x86 compatible, amd64 compatible, Alpha/AXP, IA-64, PC-98 and UltraSPARC? architectures
Other
Blogue
A Java blog
Boo
A new object oriented statically typed programming language for the Common Language Infrastructure
EDFrameworks
A collection of three frameworks that provides seamless extensions of Foundation and AppKit, and provides services for Internet applications, style sheet driven export of your objects and message handling
GUJ
A Brazilian Java users group and forum
JForum
Powerful, database-independent, and multi-threaded forum software
MCI
An Interface Builder extension allowing for advanced connections
MKConsole
A little application that displays logfiles on your desktop
ModRuby
Embedded Ruby interpreter in Apache webserver
Ruby
An object oriented scripting language
WordNet
Application to provides a graphical interface for the WordNet semantic network
Doclets, Attributes and Metadata
AgileDox
Creates simple documentation from the method names in JUnit test cases
MiddleGen
A general-purpose database-driven code generation engine
NetReflector
An attribute-based configuration framework for .NET
QDox
A very fast JavaDoc parser designed for use in code generation apps
XDoclet
A code generation engine to enable Attribute-Oriented Programming for Java
XDoclet 2
The second generation of XDoclet

February 15, 2007

GuidGen

GuidGen: "GuidGen
This page is a hopefully-nearly-identical webbased version of Microsoft's GuidGen tool to generate GUIDs. Use this version if you have no local GuidGen.exe installed on your system. You can also use the WebService."

February 04, 2007

SQL Comparison and synchronization tools - SQL Examiner

SQL Comparison and synchronization tools - SQL Examiner: "SQL Examiner is an easy-to-use database comparison tool that quickly and accurately compares and synchronizes SQL Server database schemas. With a few clicks of the mouse, SQL Examiner merges selected databases and delivers exact results by analyzing the dependencies between the objects and your data.
The tool’s flexibility allows you to be as involved as you want in the development process, from step-by-step processing to full automation. You can choose automatic, one-click synchronization and focus on the main design and development. SQL Examiner handles all the routine work itself."

March 30, 2006

Utility to Caliber your monitor

While editing digital photos monitor calibration is very important.

Link below is to find out instantly if your monitor is calibrated for optimal image display. This utility will let you know if you need to fine tune your monitor and it will guide you through the process in just a few easy steps.

http://home.comcast.net/~morrised2006/tips/monitor.htm

February 02, 2005

Passing objects using .NET remoting

Following code demonstrates how to pass object (e.g. Image) using .NET remoting. The idea here to serialize object, transfer and then deserialize back. For actual class objects you can also use RawSerialize() method at the end of this post.

Server Code:

Create DLL with following code (Project - serverObject, class name - streamer.cs)

Note : This DLL is shared between client and server. (You need to copy this dll on client machine)

Add following method:

public byte[] getImageBytes(){

string strImagePath=@"C:\unit73.jpeg";

MemoryStream objMemStr = new MemoryStream();

Image objImg = new Bitmap(strImagePath);
objImg.Save(objMemStr, ImageFormat.Jpeg);

return objMemStr.GetBuffer();
}



Create Server (Console Project) with following code: (Project - ServerStarter)


[STAThread]
static void Main(string[] args)
{
TcpChannel channel = new TcpChannel(54321); //Create a new channel
ChannelServices.RegisterChannel (channel); //Register channel
RemotingConfiguration.RegisterWellKnownServiceType(typeof(serverObject.streamer),"streamer",WellKnownObjectMode.Singleton);
Console.WriteLine ("Server ON at port number:54321");
Console.WriteLine ("Please press enter to stop the server.");
Console.ReadLine ();
}


Client code:

Note : Add Refrence (copy dll on machine) to serverObject dll.

private void DisplayImage(){
TcpChannel channel = new TcpChannel (54322); //Create a new channel
ChannelServices.RegisterChannel (channel); //Register the channel
//Create Service class object
streamer svc = (streamer) Activator.GetObject (typeof (streamer),"tcp://localhost:54321/streamer"); //Localhost can be replaced by

byte [] imgData = svc.getImageBytes();

Image objDilbertImg;
MemoryStream objMemStr = new MemoryStream();

//StreamReader objStream = new StreamReader(@"C:\myimage.jpeg", Encoding.ASCII);
objMemStr.Write(imgData,0,imgData.Length);
objDilbertImg = new Bitmap(objMemStr);
pictureBox1.Image = objDilbertImg;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
ChannelServices.UnregisterChannel (channel);
}



You can also use RawSerialize() method in streamer class to stream the data. In such case you have to change client/server code accordingly.

private byte[] RawSerialize( object anyObject )
{
int rawsize = Marshal.SizeOf( anyObject );
IntPtr buffer = Marshal.AllocHGlobal( rawsize );
byte[] rawdata = new byte[ rawsize ];
Marshal.Copy( buffer, rawdata, 0, rawsize );
Marshal.FreeHGlobal( buffer );
return rawdata;
}

January 03, 2005

300D - Learning / Techniques / Tips - Tricks ............

Here are some site which has great information on Digital Photo Learning

Some related stuff -

August 29, 2004

How to get COM+ Activation String?


Make sure to include refrence for "COM+ 1.0 Admin Type Library"

Public Function getDBHelperActivationString() As String
Dim catalog As COMAdmin.COMAdminCatalog
Dim applications As COMAdmin.COMAdminCatalogCollection
Dim application As COMAdmin.COMAdminCatalogObject

Set catalog = New COMAdmin.COMAdminCatalog
Set COMAdminCatalogCollection = catalog.GetCollection("Applications")
Call COMAdminCatalogCollection.Populate

Dim comApplication As COMAdmin.COMAdminCatalogObject

For Each comApplication In COMAdminCatalogCollection
If (strConstructorString <> "") Then
Exit For
End If

Dim applicationComponents As COMAdmin.ICatalogCollection
Set applicationComponents = COMAdminCatalogCollection.GetCollection("Components", comApplication.Key)
applicationComponents.Populate

Dim comComponent As COMAdmin.COMAdminCatalogObject
For Each comComponent In applicationComponents
If (comComponent.Name = "MRI_Svr_Db.DBHelper") Then
strConstructorString = comComponent.Value("ConstructorString")
Exit For
End If
Next
Next

getDBHelperActivationString = strConstructorString
End Function

December 29, 2003

Convert Image to Byte

Public Function GetImage() As Byte()
Dim B() As Byte
Dim srcFile As String

' /* Change This To your File */
srcFile = "c:\unit73.jpeg"

Open srcFile For Binary Access Read As #1
ReDim B(LOF(1) - 1)
Get #1, , B
Close #1

GetImage = B

End Function

File compare Utility

VERSION 5.00
Begin VB.Form frmFileCmp
Caption = "File Diff"
ClientHeight = 7440
ClientLeft = 60
ClientTop = 360
ClientWidth = 12045
Icon = "frmFileCmp.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 7440
ScaleWidth = 12045
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdCopyToClip
Caption = "C&opy Result To Clipboard"
Height = 495
Left = 9360
TabIndex = 12
Top = 5400
Width = 2295
End
Begin VB.ListBox lstLog
Height = 2595
Left = 120
TabIndex = 11
Top = 4800
Width = 9135
End
Begin VB.CommandButton cmdCmpFiles
Caption = "&Compare Files"
Height = 495
Left = 9360
TabIndex = 8
Top = 4800
Width = 2295
End
Begin VB.Frame Frame2
Caption = "Destination File Settings"
Height = 4455
Left = 6120
TabIndex = 4
Top = 0
Width = 5895
Begin VB.FileListBox fList1
Height = 3405
Left = 2880
TabIndex = 10
Top = 840
Width = 2775
End
Begin VB.DriveListBox drvSelect1
Height = 315
Left = 120
TabIndex = 6
Top = 480
Width = 2535
End
Begin VB.DirListBox dirList1
Height = 3465
Left = 120
TabIndex = 5
Top = 840
Width = 2535
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "Destination File(s)"
Height = 195
Left = 2880
TabIndex = 14
Top = 600
Width = 1245
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "Drive / Path:"
Height = 195
Left = 120
TabIndex = 7
Top = 240
Width = 915
End
End
Begin VB.Frame Frame1
Caption = "Source File Settings"
Height = 4455
Left = 0
TabIndex = 0
Top = 0
Width = 6015
Begin VB.FileListBox fList
Height = 3405
Left = 2880
TabIndex = 9
Top = 960
Width = 2775
End
Begin VB.DirListBox dirList
Height = 3465
Left = 120
TabIndex = 2
Top = 840
Width = 2535
End
Begin VB.DriveListBox drvList
Height = 315
Left = 120
TabIndex = 1
Top = 480
Width = 2535
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Source File(s)"
Height = 195
Left = 2880
TabIndex = 13
Top = 600
Width = 960
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Drive / Path:"
Height = 195
Left = 120
TabIndex = 3
Top = 240
Width = 915
End
End
Begin VB.Label Label7
Caption = "Comparison Result:"
Height = 255
Left = 120
TabIndex = 15
Top = 4560
Width = 3135
End
End
Attribute VB_Name = "frmFileCmp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmbPattern_Click()
Dim pos1 As Integer
Dim pos2 As Integer
Dim txt As String

txt = cmbPattern.Text
pos1 = InStrRev(txt, "(")
pos2 = InStrRev(txt, ")")
fList.Pattern = Mid$(txt, pos1 + 1, pos2 - pos1 - 1)

End Sub

Private Sub cmdCmpFiles_Click()
Me.MousePointer = vbHourglass
lstLog.Clear
Dim i As Integer, j As Integer
Dim bFound As Boolean
Dim aCmpReply As String
For i = 0 To fList.ListCount - 1
If (fList.List(i) = fList1.List(i)) Then
aCmpReply = FileCompare(dirList.Path & "\" & fList.List(i), dirList1.Path & "\" & fList1.List(i))
If (InStr(aCmpReply, "%")) Then
lstLog.AddItem "File " & fList.List(i) & " is " & aCmpReply & " equal"
Else
lstLog.AddItem ">>>>>>> File " & fList.List(i) & " has diffrent file size. <<<<<<"
End If
Else
bFound = False
'check file name in dest and compare
For j = 0 To fList1.ListCount - 1
If fList.List(i) = fList1.List(j) Then
aCmpReply = FileCompare(dirList.Path & "\" & fList.List(i), dirList1.Path & "\" & fList1.List(j))
If (InStr(aCmpReply, "%")) Then
lstLog.AddItem "File " & fList.List(i) & " is " & aCmpReply & " equal"
Else
lstLog.AddItem ">>>>>>> File " & fList.List(i) & " has diffrent file size. <<<<<<"
End If
bFound = True
End If
Next
If bFound = False Then
lstLog.AddItem "File Name not found for comparision - " & fList.List(i)
End If
End If
DoEvents
Next i

Me.MousePointer = vbDefault
End Sub

Private Sub cmdCopyToClip_Click()
Dim tmpMsg As String
Clipboard.Clear
For i = 0 To lstLog.ListCount - 1
tmpMsg = tmpMsg & vbCrLf & lstLog.List(i)
Next i
Clipboard.SetText tmpMsg
End Sub

Private Sub dirList_Change()
fList.Path = dirList.Path
End Sub

Private Sub fList_PatternChange()
fileList.Clear

Dim i As Integer
For i = 0 To fList.ListCount - 1
fileList.AddItem fList.List(i)
Next
End Sub

Private Sub drvSelect_Change()
'On Error GoTo DriveError
dirList.Path = drvList.Drive
Exit Sub

DriveError:
drvList.Drive = dirList.Path
Exit Sub

End Sub
'Private Sub cmdSelList_Click()
' Dim i As Integer
' If cmdSelList.Caption = "&Select All" Then
' cmdSelList.Caption = "&Deselect All"
' For i = 0 To fileList.ListCount - 1
' fileList.Selected(i) = True
' Next i
'
' Else
' cmdSelList.Caption = "&Select All"
' For i = 0 To fileList.ListCount - 1
' fileList.Selected(i) = False
' Next i
'
' End If
'
'End Sub

Public Function FileCompare(File1 As String, File2 As String) As String
Dim f1() As Byte ' our array For the first file
Dim f2() As Byte ' our array For the second file
Dim Alike As Long
Alike& = 0 'needed For the percent part
filelen1 = FileLen(File1$) 'file length of first file
FileLen2 = FileLen(File2$) 'file length of second file
If filelen1 <> FileLen2 Then FileCompare$ = "Different file size": Exit Function
'if file sizes are different, then they
' are not the same
ReDim f1(1 To filelen1) 'since we now have the file length, lets activate the arrays
ReDim f2(1 To FileLen2)
Open File1 For Binary Access Read As #1
Open File2 For Binary Access Read As #2
Get #1, 1, f1()
Get #2, 1, f2()
Close #2
Close #1
'this opens up the files, gets all the d
' ata and stores them in our arrays


For i = 1 To filelen1 Step 6
If f1(i) = f2(i) Then Alike = Alike + 1
'if they are the same, add 1 to alike co
' unter
If i + 1 > filelen1 Then GoTo skipout
'if we exceed the length of the file, th
' en leave the for,next statement IMMEDIAT
' ELY
If f1(i + 1) = f2(i + 1) Then Alike = Alike + 1
If i + 2 > filelen1 Then GoTo skipout
If f1(i + 2) = f2(i + 2) Then Alike = Alike + 1
If i + 3 > filelen1 Then GoTo skipout
If f1(i + 3) = f2(i + 3) Then Alike = Alike + 1
If i + 4 > filelen1 Then GoTo skipout
If f1(i + 4) = f2(i + 4) Then Alike = Alike + 1
If i + 5 > filelen1 Then GoTo skipout
If f1(i + 5) = f2(i + 5) Then Alike = Alike + 1


Next i
skipout:
Dim res As Double
res = Alike / filelen1 * 100
FileCompare$ = CStr(Format(res, "###.####")) & "%" 'FormatPercent(Alike / filelen1, 5))
'divide alike from filelength and format
' it into a percent
End Function



Private Sub dirList1_Change()
fList1.Path = dirList1.Path
End Sub

Private Sub fList1_PatternChange()
fileList.Clear

Dim i As Integer
For i = 0 To fList.ListCount - 1
fileList.AddItem fList.List(i)
Next
End Sub

Private Sub drvSelect1_Change()
'On Error GoTo DriveError
dirList.Path = drvList.Drive
Exit Sub

DriveError:
drvList.Drive = dirList.Path
Exit Sub

End Sub

June 19, 2003

Ms Word to HTML converter

VERSION 5.00
Begin VB.Form W2H
Caption = "IRES Word2HTML Converter"
ClientHeight = 6720
ClientLeft = 60
ClientTop = 360
ClientWidth = 11355
Icon = "W2H.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 6720
ScaleWidth = 11355
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "C&lear Log"
Height = 375
Left = 9120
TabIndex = 16
Top = 6120
Width = 2055
End
Begin VB.CommandButton cmdC2C
Caption = "&Copy Log to Clipboard"
Height = 375
Left = 6240
TabIndex = 15
Top = 6120
Width = 2295
End
Begin VB.ListBox lstLog
Height = 3570
Left = 6240
TabIndex = 13
Top = 2400
Width = 4935
End
Begin VB.CommandButton cmdC2H
Caption = "Convert to &HTML"
Height = 495
Left = 7440
TabIndex = 12
Top = 1440
Width = 2415
End
Begin VB.TextBox txtHTMLDest
Height = 375
Left = 6120
TabIndex = 10
Text = "C:\HTML"
Top = 720
Width = 5055
End
Begin VB.Frame Frame1
Height = 6495
Left = 120
TabIndex = 0
Top = 120
Width = 5895
Begin VB.ListBox fileList
Height = 5460
Left = 2760
Style = 1 'Checkbox
TabIndex = 5
Top = 840
Width = 2895
End
Begin VB.ComboBox cmbPattern
Height = 315
Left = 120
Style = 2 'Dropdown List
TabIndex = 4
Top = 6000
Width = 2535
End
Begin VB.DirListBox dirList
Height = 4815
Left = 120
TabIndex = 3
Top = 840
Width = 2535
End
Begin VB.DriveListBox drvList
Height = 315
Left = 120
TabIndex = 2
Top = 480
Width = 2535
End
Begin VB.CommandButton cmdSelList
Caption = "&Select All"
Height = 375
Left = 4320
TabIndex = 1
Top = 360
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Drive / Path:"
Height = 195
Left = 120
TabIndex = 8
Top = 240
Width = 915
End
Begin VB.Label Label2
Caption = "Select File(s) for Conversion:"
Height = 435
Left = 2760
TabIndex = 7
Top = 360
Width = 1410
WordWrap = -1 'True
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "File Pattern:"
Height = 195
Left = 120
TabIndex = 6
Top = 5760
Width = 840
End
End
Begin VB.FileListBox fList
Height = 1260
Left = 3240
TabIndex = 9
Top = 4200
Width = 975
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "Conversion Log:"
Height = 195
Left = 6240
TabIndex = 14
Top = 2160
Width = 1155
End
Begin VB.Label Label4
Caption = "HTML Destination:"
Height = 255
Left = 6120
TabIndex = 11
Top = 480
Width = 2295
End
End
Attribute VB_Name = "W2H"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdC2C_Click()
Dim i2 As Integer
Clipboard.Clear
Dim aLog As String
For i2 = 0 To lstLog.ListCount - 1
aLog = aLog & lstLog.List(i2) & vbCrLf
Next
Clipboard.SetText aLog
End Sub

Private Sub cmdC2H_Click()
Me.Enabled = False
Dim aResult As String, afile As String, apath As String
Dim i2 As Integer
Dim aCurrentFileSelectedForConversion As String

For i2 = 0 To fileList.ListCount - 1
aCurrentFileSelectedForConversion = ""
If fileList.Selected(i2) = True Then
'Do While Len(aFile)

afile = fileList.List(i2)
apath = dirList.Path & "\"
If UCase(Right$(afile, 4)) = ".DOC" Then
aCurrentFileSelectedForConversion = afile
aResult = WordToHTML(apath & afile, txtHTMLDest.Text & "\" & Left(afile, Len(afile) - 4) & ".htm")
If aResult = "Success" Then
lstLog.AddItem aCurrentFileSelectedForConversion & " Successfully Converted"
Else
lstLog.AddItem aCurrentFileSelectedForConversion & " Failed to convert. Reason - " & aResult
End If
End If
End If
DoEvents
Next
Me.Enabled = True
MsgBox "Conversion Completed !!"
End Sub

Private Sub Command1_Click()
lstLog.Clear
End Sub

Private Sub Form_Load()
cmbPattern.AddItem "Word Files (*.DOC)."
cmbPattern.AddItem "All Files (*.*)."
cmbPattern.ListIndex = 0

'dirList.Path = drvList.Drive
On Error Resume Next
dirList.Path = "C:\"

Dim DirectoryFound As String

On Error GoTo 0
DirectoryFound = Dir(txtHTMLDest.Text, vbDirectory)
If (Len(DirectoryFound) = 0 Or Err = 76) Then
MkDir txtHTMLDest.Text
End If
End Sub
Private Sub cmbPattern_Click()
Dim pos1 As Integer
Dim pos2 As Integer
Dim txt As String

txt = cmbPattern.Text
pos1 = InStrRev(txt, "(")
pos2 = InStrRev(txt, ")")
fList.Pattern = Mid$(txt, pos1 + 1, pos2 - pos1 - 1)

End Sub
Private Sub fList_PatternChange()
fileList.Clear

Dim i As Integer
For i = 0 To fList.ListCount - 1
fileList.AddItem fList.List(i)
Next
End Sub



Private Sub drvSelect_Change()
'On Error GoTo DriveError
dirList.Path = drvList.Drive
Exit Sub

DriveError:
drvList.Drive = dirList.Path
Exit Sub

End Sub
Private Sub cmdSelList_Click()
Dim i As Integer
If cmdSelList.Caption = "&Select All" Then
cmdSelList.Caption = "&Deselect All"
For i = 0 To fileList.ListCount - 1
fileList.Selected(i) = True
Next i

Else
cmdSelList.Caption = "&Select All"
For i = 0 To fileList.ListCount - 1
fileList.Selected(i) = False
Next i

End If

End Sub
Private Sub drvList_Change()
'On Error GoTo DriveError
dirList.Path = drvList.Drive
Exit Sub

DriveError:
drvList.Drive = dirList.Path
Exit Sub
End Sub

Private Sub dirList_Change()
fileList.Clear
fList.Path = dirList.Path
Dim i As Integer
For i = 0 To fList.ListCount - 1
fileList.AddItem fList.List(i)
Next
cmdSelList.Caption = "&Select All"
End Sub

'Private Sub fList_Click()
' cmdConvertToWiki_Click
'End Sub
'-----------------------------------------------------------------------
Function WordToHTML(strWordDoc, strHTMLDoc)
On Error GoTo errH

Dim objWord
Set objWord = New Word.Application ' CreateObject("Word.Application")
objWord.Visible = False
objWord.Documents.Open (strWordDoc)

If Err.Number <> 0 Then
WordToHTML = Err.Description
Else
' Dim FileFormat
' Dim LockComments
' Dim Password
' Dim AddToRecentFiles
' Dim WritePassword
' Dim ReadOnlyRecommended
' Dim EmbedTrueTypeFonts
' Dim SaveNativePictureFormat
' Dim SaveFormsData
' Dim SaveAsAOCELetter
'
' FileFormat = wdFormatHTML
' LockComments = True
' Password = ""
' AddToRecentFiles = False
' WritePassword = ""
' ReadOnlyRecommended = False
' EmbedTrueTypeFonts = False
' SaveNativePictureFormat = True
' SaveFormsData = False
' SaveAsAOCELetter = False


' objWord.activedocument.SaveAs strHTMLDoc, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter

objWord.ActiveDocument.SaveAs FileName:=strHTMLDoc, FileFormat:=10 _
, LockComments:=True, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=True, SaveFormsData:=False, SaveAsAOCELetter:= _
False

'check errors (this should be another routine)
If Err.Number <> 0 Then
WordToHTML = Err.Description
Else
WordToHTML = "Success"
End If
End If
objWord.ActiveDocument.Close
objWord.Quit
Set objWord = Nothing
Exit Function
errH:
objWord.ActiveDocument.Close
objWord.Quit
Set objWord = Nothing
WordToHTML = Err.Description
End Function

January 17, 2002

Interesting links on AI

Interesting Links on Artificial Intelligence