SSIS WMI event watcher WQL Direct Input query - sql-server

I'm using SSIS in Visual Stdio 2010 to check a specific folder for any csv files that are dropped in from a 3rd party where the filename begins with 'Despatch'. This is my WQL code:
SELECT *
FROM __InstanceCreationEvent WITHIN 5
WHERE TargetInstance ISA 'CIM_DataFile'
AND TargetInstance.Drive = 'E:'
AND TargetInstance.Path = '\\Hybris URL REST Callbacks\\Despatched\\'
AND TargetInstance.FileName LIKE 'Despatch%'
AND TargetInstance.Extension = 'csv'
However, when I run it, I just get the error "Invalid parameter".
If I modify to the below it works - but how do I search for despatch* csv files only?
SELECT * FROM __InstanceCreationEvent WITHIN 10
WHERE TargetInstance ISA "CIM_DirectoryContainsFile"
and TargetInstance.GroupComponent= "Win32_Directory.Name=\"e:\\\\Hybris URL REST Callbacks\\\\Despatched\""
Where am I going wrong?
Regards,
Michael

If anyone is interested I couldn't get this to work so using free SSIS file watcher addin:
http://www.sqlis.com/sqlis/post/File-Watcher-Task.aspx

It looks like you found another option, but if you decide to try this again it looks like the only problem was additional tabs/space in the first example you posted. After modifying it, I can run the following without any errors whereas before I was able to reproduce the same invalid parameter error.
SELECT * FROM __InstanceCreationEvent WITHIN 5
WHERE TargetInstance ISA 'CIM_DataFile' AND TargetInstance.Drive = 'E:'
AND TargetInstance.Path = '\\Hybris URL REST Callbacks\\Despatched\\' AND TargetInstance.FileName LIKE 'Despatch%'
AND TargetInstance.Extension = 'csv'

Related

How to save table output in an exportable manner in Sage

I am a sage novice trying to export a table output to some image format (so that it might be shared). I tried using the .save() function as so:
my_table1 = table(my inputs)
result = my_table1.transpose()
result.save('here')
My table outputs properly after I run the program (not featured), but for some reason I receive the following error when I try and save the table:
"Error! /home/sage/Documents/here.sobj is not UTF-8 encoded
Saving disabled.
See Console for more details."
Any help in exporting this table is greatly appreciated. Additionally, if you require any more information please do not hesitate to ask!
Background: I am working in Jupyter for Sage on a browser via localhost/8000; not sure if that matters. My OS is Windows 10 and I am using Sage version 7.6.
Would LaTeX output help? Using an example in the documentation for table?:
rows = [['a', 'b', 'c'], [100,2,3], [4,5,60]]
table(rows)._latex_()
'\\begin{tabular}{lll}\na & b & c \\\\\n$100$ & $2$ & $3$ \\\\\n$4$ & $5$ & $60$ \\\\\n\\end{tabular}'
You could try for the html but that would be harder, because it returns a HTMLFragment object, and you'd need the MathJax for it to look right.
str(table(rows)._html_())
'<div class="notruncate">\n<table class="table_form">\n<tbody>\n<tr class ="row-a">\n<td>a</td>\n<td>b</td>\n<td>c</td>\n</tr>\n<tr class ="row-b">\n<td><script type="math/tex">100</script></td>\n<td><script type="math/tex">2</script></td>\n<td><script type="math/tex">3</script></td>\n</tr>\n<tr class ="row-a">\n<td><script type="math/tex">4</script></td>\n<td><script type="math/tex">5</script></td>\n<td><script type="math/tex">60</script></td>\n</tr>\n</tbody>\n</table>\n</div>'
In any case, the image wouldn't be savable as-is. Unless you took a screenshot!

Need to create a copy of a Database to a location not under Data

I want to create a copy of a database to a folder not under the data either locally or on a server I have code that looks like this:
var arcName:String = "C:\Archive\MyArchives\SomeName.nsf"
var arcDB:NotesDatabase = appDB.createCopy("", arcName);
When the action finishes (it does not generate any errors) I can't find the database anywhere. if I change the arcName to "Archives\Myarchives\SomeName,nsf" the process works correctly. But I don't want these Archives under Data.
Using the full path does not seem to make it move out from under the Data folder.
This may be a case of string escaping - in SSJS, like most C-lineage languages, \ is the escape character. Give it a shot with \\ in place of each. In my testing, it works as database.createCopy("", "C:\\Archive\\MyArchives\\SomeName.nsf").

VBA - file saves as tab-delimited instead of csv

I'm getting slightly confused by this issue. I have a macro that grabs data from one spreadsheet, re-formats it and saves in another spreadsheet. Everything works perfectly well but this piece of code seems to be working incorrectly:
Set NewBook = Workbooks.Add
With NewBook
.Title = "Pts"
.SaveAs Filename:="C:\Minestar_exports\" & Pts & "", FileFormat:=xlCSV,
CreateBackup:=False
.Close
End With
The trouble is that it save the file all right but seems to ignore the FileFormat:=xlCSV bit and saves it as TAB-delimeted instead. It's no biggie, when macro finishes running I just overwrite the temporary file using proper file format but still I couldn't figure out why this is happening. Any suggestions?
maybe, it has to do with your Windows regional settings.
Have a look to: http://excel.tips.net/T003232_Specifying_a_Delimiter_when_Saving_a_CSV_File_in_a_Macro.html
with regards, Christian Hahn.

Trouble with CreateNewSite() bindings -- WMI -- IIS6

I am successfully creating new IIS 6 websites using the CreateNewSite() function, but would like to add an additional two hostname bindings (see below).
Questions:
Does the CreateNewSite() function support multiple hostname bindings?
If so, what is the syntax? In all the example code I've found out there, I only find copies of the original MS code, with no examples of additional bindings, or even examples of modification functions.
I have already reviewed this blog page...
http://stweet.wordpress.com/2010/03/15/creating-a-new-website-programmatically-on-iis-using-asp-net/
... and while I saw something that looked like multiple domains, the code format was different, and so I'm not sure how it relates to the VBS I am using.
Thanks,
Mik
`
Bindings = Array(0)
Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_()
Bindings(0).IP = myIPnumber
Bindings(0).Port = "80"
Bindings(0).Hostname = WScript.Arguments(0)
' Create the new Web site using the CreateNewSite method of the IIsWebService object.
Dim strSiteObjPath
strSiteObjPath = serviceObj.CreateNewSite("RF_" & WScript.Arguments(0), Bindings, "D:\websites\" & WScript.Arguments(0) & "\httpdocs", WScript.Arguments(2))
`
The WScript.Arguments(2) is a custom IIS service number.

Octave select a file?

Does Octave have a good way to let the user select an input file? I've seen code like this for Matlab, but doesn't work in Octave.
A gui based method would be preferred, but some sort of command-line choice would work also. It would be great if there were some way to do this that would work in both Matlab and Octave.
I found this for Matlab but it does not work in Octave, even when you install Octave Forge Java package for the listdlg function. In Octave, dir() gives you:
647x1 struct array containing the fields:
name
date
bytes
isdir
datenum
statinfo
but I don't know how to convert this to an array of strings listdlg expects.
You have already the Octave Forge java package installed, so you can create instances of any java class and call any java method.
For example to create a JFileChooser and call the JFileChooser.showOpenDialog(Component parent) method:
frame = javaObject("javax.swing.JFrame");
frame.setBounds(0,0,100,100);
frame.setVisible(true);
fc = javaObject ("javax.swing.JFileChooser")
returnVal = fc.showOpenDialog(frame);
file = fc.getSelectedFile();
file.getName()
Btw. I had some troubles installing the package.
Here is a fix for Ubuntu. that worked also for my Debian Testing.
EDIT
#NoBugs In reply to your comment:
If you need to use listdlg you can do the following:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str);
if ok == 1
disp(str{sel(1)});
end
This should be compatible with matlab, by I cannot test it right now.
If you want to select multiple files use this:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','multiple',...
'ListString',str);
if ok == 1
imax = length(sel);
for i=1:1:imax
disp(str{sel(i)});
end
end
I never came across an open-file-dialog in octave.
If you are looking for a gui based method maybe guioctave can help you. I never used it, because it appears only be available for windows machines.
A possible solution would be to write a little script in octave, that would allow the user to parse through the directories and select a file like that.
Thought I'd provide an updated answer to this old question, since it is appearing in the 'related questions' field for other questions.
Octave provides the uigetdir and uigetfile functions, which do what you expect.

Resources