'
' www.pullnews.com
' Save this code into file ImportFromBin64.vbs
'
If WScript.Arguments.Count= 0 Then
MsgBox "Usage instruction:" & vbCrLf & _
"Drag source file and drop on vbs file to process"
WScript.Quit
End If
Set fso = CreateObject("Scripting.FileSystemObject")
sInFName = WScript.Arguments(0)
sPath = fso.GetParentFolderName (WScript.ScriptFullName)
ConvertBin64ToBinary sInFName
' Convert bin64 from xml file into binary file
Sub ConvertBin64ToBinary(sInFileName)
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
'Load xml doc
If xmlDoc.Load(sInFName) = False Then
MsgBox "Invalid XML request"
Else
Set oNode = xmlDoc.selectSingleNode("DATA")
sOutFName = oNode.getAttribute("FileName")
SaveBinaryData sPath & "\" & sOutFName, _
oNode.nodeTypedValue
End If
End Sub
' Save binary buffer to file
Function SaveBinaryData(FileName,ByteArray)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
'Write binary data to stream object
BinaryStream.Write ByteArray
'Save to file
BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
End Function
Wednesday, September 26, 2007
Tuesday, September 18, 2007
Convert binary file into bin64 string with VBScript
'
' www.pullnews.com
' Save this code into file ConvertToBin64.vbs
'
If WScript.Arguments.Count= 0 Then
MsgBox "Usage instruction:" & vbCrLf & _
"Drag source file and drop on vbs file to process"
WScript.Quit
End If
Set fso = CreateObject("Scripting.FileSystemObject")
sInFName = WScript.Arguments(0)
sPath = fso.GetParentFolderName (WScript.ScriptFullName)
sOutFName = sPath & "\base64.xml"
SaveToXMLAsBin64 sInFName, sOutFName
' Save binary buffer into xml file in bin64 format
Sub SaveToXMLAsBin64(sInFileName, sOutFileName)
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
'create a node
Set oElement = xmlDoc.createElement("DATA")
oElement.dataType = "bin.base64"
oElement.nodeTypedValue = ReadBinaryFile(sInFileName)
'save file name as well
oElement.setAttribute "FileName", fso.GetFileName( sInFName )
xmlDoc.appendChild oElement
'save file
xmlDoc.save sOutFileName
End Sub
' Read binary or text file into buffer
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To get binary data.
BinaryStream.Type = adTypeBinary
'Open the stream
BinaryStream.Open
'Load the file data from disk To stream object
BinaryStream.LoadFromFile FileName
'Open the stream And get binary data from the object
ReadBinaryFile = BinaryStream.Read
End Function
' www.pullnews.com
' Save this code into file ConvertToBin64.vbs
'
If WScript.Arguments.Count= 0 Then
MsgBox "Usage instruction:" & vbCrLf & _
"Drag source file and drop on vbs file to process"
WScript.Quit
End If
Set fso = CreateObject("Scripting.FileSystemObject")
sInFName = WScript.Arguments(0)
sPath = fso.GetParentFolderName (WScript.ScriptFullName)
sOutFName = sPath & "\base64.xml"
SaveToXMLAsBin64 sInFName, sOutFName
' Save binary buffer into xml file in bin64 format
Sub SaveToXMLAsBin64(sInFileName, sOutFileName)
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
'create a node
Set oElement = xmlDoc.createElement("DATA")
oElement.dataType = "bin.base64"
oElement.nodeTypedValue = ReadBinaryFile(sInFileName)
'save file name as well
oElement.setAttribute "FileName", fso.GetFileName( sInFName )
xmlDoc.appendChild oElement
'save file
xmlDoc.save sOutFileName
End Sub
' Read binary or text file into buffer
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To get binary data.
BinaryStream.Type = adTypeBinary
'Open the stream
BinaryStream.Open
'Load the file data from disk To stream object
BinaryStream.LoadFromFile FileName
'Open the stream And get binary data from the object
ReadBinaryFile = BinaryStream.Read
End Function
Wednesday, September 12, 2007
Create WAMP server with Virtual PC
WAPM is an acronym for Web Server based on Apache, PHP and MySQL installed on Windows. Virtual PC is a free software from Microsoft, that enables you to play with out of box environments. It is assumed that Virtual PC is already installed. Than next is:
1. Install operating system, for me I do prefer of Windows 2000.
2. Simplify interaction and improve performance with Virtual PC by installing Virtual Machine Additions.
3. Absolutely necessary is to install Windows 2000 Service Pack 4.
Otherwise latest Apache installation will fail.
4. Install Internet Explorer 6 or latest FireFox. To work with local host environments.
5. Install Apache, and my choice is latest version Apache 2.2
Provide valid email address for administrator, otherwise Apache will fail to start. Create web site folder like "c:\www", and configure Apache to use it by editing httpd.conf file.
6. Install MYSQL 5.0.48, add select check box "add mysql to environment variables"
Create the database from a command line
mysqladmin -u USERNAME -p create DATABASE
Import the backup data
mysql -u USERNAME -p DATABASE < FILENAME.mysql
7. Install GUI for MySQL 1.12
8. Install PHP 5.2.3
Configure to use extentions GD2 and MySQL
9. Install PHP editor Notepad++
A. Optional is to install debugging framework like xdebug 2.0.0
Created virtual machine file could be cloned and reused with multiple development environments.
Using Pointing Device on Dell laptop will make Virtual PC consistently crash.
With MySQL 4.4.8 possible error could be shown on start of Apache - "could not locate libmysql.dll". Simple reboot of virtual system may solve the problem.
1. Install operating system, for me I do prefer of Windows 2000.
2. Simplify interaction and improve performance with Virtual PC by installing Virtual Machine Additions.
3. Absolutely necessary is to install Windows 2000 Service Pack 4.
Otherwise latest Apache installation will fail.
4. Install Internet Explorer 6 or latest FireFox. To work with local host environments.
5. Install Apache, and my choice is latest version Apache 2.2
Provide valid email address for administrator, otherwise Apache will fail to start. Create web site folder like "c:\www", and configure Apache to use it by editing httpd.conf file.
6. Install MYSQL 5.0.48, add select check box "add mysql to environment variables"
Create the database from a command line
mysqladmin -u USERNAME -p create DATABASE
Import the backup data
mysql -u USERNAME -p DATABASE < FILENAME.mysql
7. Install GUI for MySQL 1.12
8. Install PHP 5.2.3
Configure to use extentions GD2 and MySQL
9. Install PHP editor Notepad++
A. Optional is to install debugging framework like xdebug 2.0.0
Created virtual machine file could be cloned and reused with multiple development environments.
Using Pointing Device on Dell laptop will make Virtual PC consistently crash.
With MySQL 4.4.8 possible error could be shown on start of Apache - "could not locate libmysql.dll". Simple reboot of virtual system may solve the problem.
Thursday, September 6, 2007
Remarks about Virtual Server 2005
There are a few thing that user has to know when running Virtual Server 2005 R2 SP1
1. To enable file sharing is required to share folder on Virtual Machine drive. That is different than use of Share Folders in Virtual PC.
2. There is annoying laud beep sound every time when an operating system event occurs in Virtual Machine. To disable this use "How to turn off the beep sound in a virtual machine in Virtual Server 2005" article from http://support.microsoft.com/kb/838671
If Virtual Server is already ON the best choice is to use command prompt and execute next command:
net stop beep
1. To enable file sharing is required to share folder on Virtual Machine drive. That is different than use of Share Folders in Virtual PC.
2. There is annoying laud beep sound every time when an operating system event occurs in Virtual Machine. To disable this use "How to turn off the beep sound in a virtual machine in Virtual Server 2005" article from http://support.microsoft.com/kb/838671
If Virtual Server is already ON the best choice is to use command prompt and execute next command:
net stop beep
Subscribe to:
Posts (Atom)