Can the command line EXE be run at server side via WCF?

Jul 11, 2010 at 5:09 AM

I'd would like to create the proper CSV file with SL client, upload the the CSV and related files to a WCF server. Then I'd like to call the Command line, pass it the CSV file to generate the CXML and DZ files. Is this possible?

If not how else can I do it at server side by just reading the CSV file to figure out the Cacet Categories and items, without hard coding class for the Facet Categories. I need to do what Command line does at server side and be able to have call backs to know when it was finished.

Thanks!

..Ben

Coordinator
Jul 11, 2010 at 7:29 AM
Hello Ben,

I'm not sure I completely understand what you're trying to do, but the current version of Pauthor may either be used as a command-line tool, or by using the software library in your own code. The Silverlight PivotViewer does not support creating collections, only viewing them.

In order to create a collection, you should start by creatinh your CSV file either by writing some code which produces it, by using a program like Excel, or even by just writing it manually using a txt editor like notepad. Once you have that file, you could use the Pauthor command-line toll to produce the CXML and Deep Zoom images.

Hope that helps!

Andrew Miner

On Jul 10, 2010, at 22:10, "BenHayat" <notifications@codeplex.com> wrote:

From: BenHayat

I'd would like to create the proper CSV file with SL client, upload the the CSV and related files to a WCF server. Then I'd like to call the Command line, pass it the CSV file to generate the CXML and DZ files. Is this possible?

If not how else can I do it at server side by just reading the CSV file to figure out the Cacet Categories and items, without hard coding class for the Facet Categories. I need to do what Command line does at server side and be able to have call backs to know when it was finished.

Thanks!

..Ben

Jul 11, 2010 at 1:32 PM

Hi Andrew;

I understand the Pauthor does not work in Silverlight. Let me pose the questions in separate formats:

a) Is it possible for the "command line.exe" to be executed at server side in silent mode? Suppose I have created and uploaded my CSV file via Silverlight client and I have a WCF server at the backend. Once the CSV file and [original] image files are there, is it possible for me to run the Command line with parameters or is the command line only to run on a PC? You see users will be uploading their images and CSV files to server to get converted to CXML files and DZ files.

b) Secondly, if it is not possible [to execute command line at server], then the only other way is to use the library in my WCF server code to accomplish the creation of CXML and DZ files. Now my question is, does the library have methods to create CXML and DZ files or do I have manually create them, like all the naming for DZ xml files and etc.?

Thank you again?

..Ben

Jul 11, 2010 at 2:26 PM

Andrew, is it possible to get a simple sample [source code] that reads a CSV file and creates the CXML collection and DeepZoom files. I looked at the CommandLine source code, and I honestly didn't understand it.

I need to understand the basics and how to use it at server side. Any help is appreciated.

Thanks!

..Ben

 

Coordinator
Jul 11, 2010 at 2:52 PM
Edited Jul 11, 2010 at 2:56 PM

Hello Ben,

It is definitely possible to run the command-line tool on a server. Check out the User's Guide in the Documentation section for details on how to run it. In particular, there's a section toward the bottom which gives several examples of how to invoke i

However, you may find it more useful to use the library itself from within your server code. That way, you don't have to mess around with managing a second process. Here's the general idea of what you'd want to do:

#using Microsoft.LiveLabs.Pauthor.Streaming;
#using Microsoft.LiveLabs.Pauthor.Streaming.Filters;
#using Microsoft.LiveLabs.Pauthor.Streaming.Filters.OleDb;

...

IPivotCollectionSource source = new CsvCollectionSource(userFileName);
IPivotCollectionTarget target = new LocalCxmlCollectionTarget(finalCxmlFileName);

DeepZoomTargetFilter deepZoomFilter = new DeepZoomTargetFilter(target);
target = deepZoomFilter;

target.Write(source);
source.Dispose();
target.Dispose();

If you want to understand the code better, I'd recommend checking out the PauthorLib Overview in the Documentation section as well.

Andrew

Jul 11, 2010 at 3:19 PM

Thank you Andrew for the reply;

Yes, running the command line on server poses several issues:

a) There will be more than one process at a time, since once the user uploads the batch process begins.

b) secondly, I'd need to have call back to know when the job was finished, in order to process the next task. So I do agree, it's best to embed the library into the code.

At this point, my questions are:

a) I need to provide three CSV files: Collection (for Name, Icon, Brand_Image and etc.), Face_Categories(Name, Type, Format, etc) and Items(Name, Image, Description, HREF, and others). How will I send it three files as one input source?

b) Since the Facet_Categories and Items from different users have different Facets_Categories, Does the library automatically reads these new (like, Age, Mode#, Color, and etc) Face_Categories and then create the appropriate CXML?

c) Does the library call automatically the DZ library, to create the folders and XML files and pass the names of the XML back to the pauthor library to store in CXML?

If you could answer these three points, at least I get a better idea how to go about it.

Are you planning to add more samples (please :-) )?

 

Coordinator
Jul 11, 2010 at 5:12 PM

To answer your questions:

a/b) You don't actually need to provide all three files if you are happy with the default values assumed by the CsvCollectionSource.  By default, the code will assume that you want each column to become a facet category with the same name and String type, and that you don't want to specify the Name, Icon, Brand Image, etc.

If you do want to provide the extra information, the code will automatically look for files which share the same base name as your items file.  So, for example, you may want to assign a unique value to each user-submitted request, and then create the three files with that as the common prefix.  In that case, your code might look like:

#using Microsoft.LiveLabs.Pauthor.Streaming;
#using Microsoft.LiveLabs.Pauthor.Streaming.Filters;
#using Microsoft.LiveLabs.Pauthor.Streaming.OleDb;

...

String baseName = Guid.New().ToString();
File.WriteAllText(baseName + ".csv", userSubmittedCsvText);
File.WriteAllText(baseName + "_facetcategories.csv", facetCategoriesCsvText);
File.WriteAllText(baseName + "_collection.csv", collectionCsvText);

CsvCollectionSource source = new CsvCollectionSource(baseFileName + ".csv");
...

I think you get the idea, but, as I said before, you can skip the foo_facetcategories.csv and foo_collection.csv if you like the default results.

c) In my prior example, the combination of the LocalCxmlCollectionSource and DeepZoomTargetFilter will create all the CXML and Deep Zoom files automatically.  There's nothing for you to do.

I think you'll find something very much like this covered in the sample code for the RSS Crawler.

Andrew

 

PS: Please excuse any errors in the code... I'm writing without access to a compiler.  :-)

Jul 12, 2010 at 4:11 PM
Andrew, thank you very much for answering these straight to the point. Your approach for the the naming of the three files, was exactly what I was thinking last night. Great to be on the same page. I'm [trying] to learn these as fast as possible with the docs and samples provided. So, now the two (LocalCxmlCollectionSource and DeepZoomTargetFilter) makes more sense. I'm going to look at the RSS Crawler in more detail and I hope you don't mind me follow up with some more questions. Thanks again! ..Ben
Jul 25, 2010 at 5:46 AM
aminer wrote:
IPivotCollectionSource source = new CsvCollectionSource(userFileName);
IPivotCollectionTarget target = new LocalCxmlCollectionTarget(finalCxmlFileName);

DeepZoomTargetFilter deepZoomFilter = new DeepZoomTargetFilter(target);
target = deepZoomFilter;

Andrew

 

Hi Andrew;

I was looking at the code you wrote on July 11th, and I don't understand why set the target=deepZoomFilter, as I've shown in above code;

Can you shed some light on this please?
Thanks!

..Ben

Coordinator
Jul 27, 2010 at 7:04 PM
Edited Jul 27, 2010 at 7:19 PM

Hello Ben,

I did that just to keep things simple later on.  Essentially, you're wrapping the original target with the new filter, so later on in your code, anything you would have done with the target you want to happen to the filter instead.  By assigning deepZoomFilter to target, you're ensuring that you can't accidentally bypass the filter later on.

 

Andrew

Jul 27, 2010 at 7:14 PM
Oh I see; Thank you once again; BTW, questions related to pAthutor, should I post them in this forum or the Pivot forum. I see you're in both places but which one do you think would get a better attention? Thanks! ..Ben
Coordinator
Jul 27, 2010 at 7:19 PM

Either place will get my attention, but there are quite a few more people watching the GetSatisfaction page.  If you post over there, both other users and other Live Labs employees will notice your question and be able to respond.

 

Andrew

Jul 27, 2010 at 7:24 PM
Thank you Sir! I'll continue on Pivot Forum!