I'm trying to move a website that was on:
Windows 2003,
IIS 6, and
Indexing Services
to:
Windows 2008,
IIS 7, and
Windows Search
It's Windows Search that's giving me a problem. I've set up a Windows Search to index the physical folder that contains the site, and I can query for file names, but what is the new equivalent of vpath and characterization?
None of these seem to be the answer.
characterization = System.Search.AutoSummary
Reference
Query the "directory","filename" properties from the Indexing Service. Then, using ASP Classic / VbScript, with RS representing a recordset:
Function MapURL( Path )
' opposite of server.mappath - takes a filesystem path and turns it into a url
Dim AppPath
AppPath = Server.MapPath("/")
path = Replace(path,apppath,"",1,-1,1)
path = Replace(path,"\","/",1,-1,1)
MapURL = path
End Function
Dim vpath
do while not rs.EOF
vpath = rs("directory") & "/" & rs("filename")
response.write MapURL(vpath)
rs.movenext
loop
Based on ASP.NET code from http://geekswithblogs.net/AlsLog/archive/2006/08/03/87032.aspx
Related
Very similar to this question but I want to build an .accde from an .accdb file and try to integrate this into a DevOps pipeline. Is this possible maybe with maybe powershell or basic cmd commandS?
There seems to an undocument command that does this job (VBS)
Dim app
Dim strDBName
Dim strADEName
Set app = CreateObject("Access.Application")
strDBName = "Path_To_YourAccdb.accdb" 'e.g C:\Temp\Myapp.accdb
strADEName = "nameOf_The_Compiled.accde" 'e.g. C:\Temp\MyApp.accde
app.SysCmd 603, CStr(strDBName), CStr(strADEName)
Set app = Nothing
Just put the above is a vbscript and it will do the job just fine
Taken from here : https://codekabinett.com/rdumps.php?Lang=2&targetDoc=make-access-accde-vb-script
I've been struggling to deploy my shiny app using the tesseractpackage. It seems that it can't 'reach' the downloaded languages. In my case: English and Dutch.
When setting up the language, the resulting object should 'point' to a path. That's the part where shiny can't open the connection.
Any help would be much appriciated!
Kind regards, R
Below I've copied the error message and the relevant code.
This is the error message I get after deployment:
Warning in file(con, "wb") :
cannot open file '/usr/share/tesseract-ocr/tessdata/nld.traineddata': Permission denied
Error in value[3L] : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted
This is my code
#loading software requirement
library(tesseract)
#download language (dutch)
tesseract_download('nld')
tesseract_download('eng')
#set language parameters for later use.
dutch <- tesseract('nld')
english <- tesseract('eng')
I've managed to get it working myself. The key was taking the following steps:
Creating a subdirectory (of folder) which is called 'tessdata'. This subdirecty is the directory you can download the languages in and 'set' the languages.
When deploying your app, you have to deploy this tessdata-subdirectory as well. So in the deployement prompt, you 'tick' the boxes of this folder as well.
Then make sure the tesseract engine points at the following path:
Screenshot of how to upload the tessdata-folder along with the app
enter image description here
Please see the code below
#loading software requirementlibrary(tesseract)
#Make sure the tesseract package is 'pointing' at the right 'parent directory'
#which is in this case the path your shiny app is working from.
#That's why you need the dot ("."). Which is in essence the workdir.
Sys.setenv(TESSDAT_PREFIX = ".")
#so combining the workdir and the pre-installed folder 'tessdata'
path <- paste0(getwd(), '/tessdata')
#use this path for downloading
#download languages (dutch and english)
tesseract_download('nld', datapath = path)
tesseract_download('eng', datapath = path)
#set language parameters for later use, using the same path
dutch <- tesseract('nld', datapath = path)
english <- tesseract('eng', datapath = path)
I have nearly a hundred data sources in a WebSphere Application Server (WAS) and due to office relocation, the IP of the database servers have changed and I need to update the datasource IP addresses in my WAS too.
Considering it error-prone to update hundred IPs through admin console.
Is there any way that I can make the change by updating config files or running a script? My version of WAS is 7.0.
You should be able to use the WAS Admin Console's built-in "command assistance" to capture simple code snippets for listing datasources and changing them by just completing those operations in the UI once.
Take those snippets and create a new jython script to list and update all of them.
More info on command assistance:
http://www.ibm.com/developerworks/websphere/library/techarticles/0812_rhodes/0812_rhodes.html
wsadmin scripting library:
https://github.com/wsadminlib/wsadminlib
You can achieve this using wsadmin scripting. Covener has the right idea with using the admin console's command assistance to do the update once manually (to get the code) and then dump that into a script that you can automate.
The basic idea is that a datasource has a set of properties nested under it, one of which is the ip address. So you want to write a script that will query for the datasource, find its nested property set, and iterate over the property set looking for the 'ipAddress' property to update.
Here is a function that will update the value of the "ipAddress" property.
import sys
def updateDataSourceIP(dsName, newIP):
ds = AdminConfig.getid('/Server:myServer/JDBCProvider:myProvider/DataSource:' + dsName + '/')
propertySet = AdminConfig.showAttribute(ds, 'propertySet')
propertyList = AdminConfig.list('J2EEResourceProperty', propertySet).splitlines()
for prop in propertyList:
print AdminConfig.showAttribute(prop, 'name')
if (AdminConfig.showAttribute(prop, 'name') == 'ipAddress'):
AdminConfig.modify(prop, '[[value '" + newIP + "']]')
AdminConfig.save();
# Call the function using command line args
updateDataSourceIP(sys.argv[0], sys.argv[1])
To run this script you would invoke the following from the command line:
$WAS_HOME/bin/wsadmin.sh -lang jython -f /path/to/script.py myDataSource 127.0.0.1
**Disclaimer: untested script. I don't know the name of the "ipAddress" property off the top of my head, but if you run this once it will print out all the properties on your ds, so you can get it there
Some useful links:
Basics about jython scripting
Modifying config objects using wsadmin
As an improvement to aguibert's script, to avoid having to provide all 100 datasource names and to update it to correct the containment path of the configuration id, consider this script which will update all datasources, regardless of the scope at which they're defined. As always, backup your configuration before beginning and once you're satisified the script is working as expected, replace the AdminConfig.reset() with save(). Note, these scripts will likely not work properly if you're using connection URLs in your configuration.
import sys
def updateDataSourceIP(newIP):
datasources = AdminConfig.getid('/DataSource:/').splitlines()
for datasource in datasources:
propertySet = AdminConfig.showAttribute(datasource, 'propertySet')
propertyList = AdminConfig.list('J2EEResourceProperty', propertySet).splitlines()
for prop in propertyList:
if (AdminConfig.showAttribute(prop, 'name') == 'serverName'):
oldip = AdminConfig.showAttribute(prop, 'value')
print "Updating serverName attribute of datasource '" + datasource + "' from " + oldip + " to " + sys.argv[0]
AdminConfig.modify(prop, '[[value ' + newIP + ']]')
AdminConfig.reset();
# Call the function using command line arg
updateDataSourceIP(sys.argv[0])
The script should be invoked similarly to the above, but without the datasource parameter, the only parameter is the new hostname or ip address:
$WAS_HOME/bin/wsadmin.sh -lang jython -f /path/to/script.py 127.0.0.1
We have used wix to create Msi. Each Msi will be having 1 or 2 or 3 features such as Appserver feature, Webserver feature and DB server feature.
Now i was asked to get the list of config files presented in each feature.
It is tough to find the list of web.config files associated with each feature through wxs file.
Is it possible find the list of files associated with a feature with particular search pattern?
For ex. Find all the web.config files packed in Appserver feature.
Is there any way easy way ( querying or some other automated script such as powershell) to get the list?
Wix comes with a .NET SDK referred to as the DTF ("deployment tools foundation"). It wraps the windows msi.dll among other things. You can find these .NET Microsoft.Deployment.*.dll assemblies in the SDK subdirectory of the Wix Toolset installation directory. The documentation is in dtf.chm and dtfapi.chm in the doc subdirectory.
As shown in the documentation, you can use this SDK to write code which queries the msi database with SQL. You will be interested in the Feature, FeatureComponents and File tables.
If you haven't explored the internals of an MSI before, you can open it with orca to get a feel for it.
You can do it by making slight modifications to the Get-MsiProperties function described in this PowerShell article.
Please read the original article and create the prescribed comObject.types.ps1xml file.
function global:Get-MsiFeatures {
PARAM (
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,HelpMessage="MSI Database Filename",ValueFromPipeline=$true)]
[Alias("Filename","Path","Database","Msi")]
$msiDbName
)
# A quick check to see if the file exist
if(!(Test-Path $msiDbName)){
throw "Could not find " + $msiDbName
}
# Create an empty hashtable to store properties in
$msiFeatures = #{}
# Creating WI object and load MSI database
$wiObject = New-Object -com WindowsInstaller.Installer
$wiDatabase = $wiObject.InvokeMethod("OpenDatabase", (Resolve-Path $msiDbName).Path, 0)
# Open the Property-view
$view = $wiDatabase.InvokeMethod("OpenView", "SELECT * FROM Feature")
$view.InvokeMethod("Execute")
# Loop thru the table
$r = $view.InvokeMethod("Fetch")
while($r -ne $null) {
# Add property and value to hash table
$msiFeatures[$r.InvokeParamProperty("StringData",1)] = $r.InvokeParamProperty("StringData",2)
# Fetch the next row
$r = $view.InvokeMethod("Fetch")
}
$view.InvokeMethod("Close")
# Return the hash table
return $msiFeatures
}
I have a task: files available over WebDAV on a remote server (SSL required) must be checked for whether they may have been updated recently, and if so copied to a local folder. There are a number of other actions that need to be performed after they arrive (copied to other folders, processed, etc.). The operating system I'm working from is Windows 2003 Server. I'd love to be able to use PowerShell for this task.
Naturally, I need to browse the files. I've looked tentatively at several solutions:
Trying to map a drive using "net use" (so far, I get a system 67 error)
Using a product like WebDrive to map a drive (as it happens, WebDrive and another utility on the server seem to conflict with each other for mysterious reasons)
Browse and manipulate the files by issuing http requests using the .NET HTTPWebRequest object hierarchy through PowerShell (works, but seems a bit complicated)
Purchase a commercial .NET assembly that simplifies working with WebDAV (ones that I've seen look pricey)
Have you needed to do something similar? Which approach is best? Any that I have missed? TIA.
It will work from powershell. Note this example:
http://thepowershellguy.com/blogs/posh/archive/2008/05/31/cd-into-sysinternals-tools-from-powershell.aspx
The problem is that the 'web client service' not running on the windows 2003 server (it's disabled by default).
The clue was the "System 67 error"
I confirmed this from a win2k3 server, starting the 'web client service' will get WebDAV working (and probably powershell). It will work out of the box on an XP client (service is running by default).
Let me know if this doesn't resolve it for you.
As an alternative to PowerShell, you could always do this from a WSH script. Example:
<job>
<reference object="ADODB.Connection"/>
<object id="cnIPP" progId="ADODB.Connection"/>
<object id="recDir" progId="ADODB.Record"/>
<script language="VBScript">
Option Explicit
Private waArgs
Private strSubDir
Private rsItems
Private strLine
Set waArgs = WScript.Arguments
If waArgs.Count < 3 Then
WScript.Echo "Parameters: FolderURL User PW [SubDir]"
WScript.Quit
End If
cnIPP.Open "Provider=MSDAIPP.DSO;Prompt=NoPrompt;" _
& "Connect Timeout=10;" _
& "Data Source=" & waArgs(0), _
waArgs(1), waArgs(2), adConnectUnspecified
If waArgs.Count = 4 Then
strSubDir = waArgs(3)
Else
strSubDir = vbNullString
End If
Set waArgs = Nothing
recDir.Open strSubDir, cnIPP, adModeRead, adFailIfNotExists, _
adDelayFetchFields Or adDelayFetchStream
Set rsItems = recDir.GetChildren()
With rsItems
WScript.Echo .Fields("RESOURCE_PARENTNAME").Value
Do Until .EOF
If .Fields("RESOURCE_ISCOLLECTION").Value Then
strLine = " [DIR] " & .Fields("RESOURCE_PARSENAME").Value
Else
strLine = " " _
& " " & .Fields("RESOURCE_PARSENAME").Value _
& " " & CStr(.Fields("RESOURCE_LASTWRITETIME").Value)
End If
WScript.Echo strLine
.MoveNext
Loop
.Close
End With
Set rsItems = Nothing
recDir.Close
cnIPP.Close
</script>
</job>
A sample run:
D:\Scripts>cscript WebDAV.wsf https://my.dav.com/~fred fred fredPW
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
https://my.dav.com/~fred
junk.htm 2/26/2008 4:28:44 AM
test.log 3/30/2009 12:30:45 PM
[DIR] _private
[DIR] stuff
D:\Scripts>
This approach should work with both WebDAV and FrontPage enabled servers without change. The example defaults to protocol auto-negotiation.
To actually retrieve data you'd open an ADODB.Stream on an ADODB.Record opened on the non-directory item.