ELKI - Use List<String> of objects to populate the Database - cluster-analysis

Sorry for the naive question, but I got stuck while following all the pieces of tutorials available.
So, is there a way to populate a Database db from a simple List rather than loading it reading a file?
Basically what I'm looking for is something similar to:
List objects = ...
Database db = ClassGenericsUtil.parameterizeOrAbort(ArrayDatabase.class, params, objects);
db.initialize();
Thanks in advance.

What are the contents of your Strings?
Same as understood by the ELKI parsers?
This will likely require some code modifications, because the parsers are designed around Javas InputStream. I don't suggest wrapping a List<String> into an InputStream although that would probably be the least-effort approach.
Why don't you try extending AbstractDatabaseConnection (or implementing DatabaseConnection)? The database connection format, MultipleObjectsBundle is not much more than List<Object> and relation metadata; fairly easy to construct.
Alternatively, you could use your own code to parse the Strings into double[] and then use ArrayAdapterDatabaseConnection; which will wrap the double[] as DoubleVector for you and construct the bundles.

Related

Is there an easier way to discover function parameters in MemSQL?

I need to enumerate all parameters in a MemSQL function. Is there an easier way other than using SHOW CREATE FUNCTION and then parsing the definition? For example, when using MySql, I could use
connection.GetSchema("Procedure Parameters",
new string[] { null, database, structureName });
Unfortunately there isn't really a better approach right now. The GetSchema method from your example makes use of a MySQL metadata table that is currently unsupported in MemSQL.

Most efficient way to change the value of a specific tag in a DICOM file using GDCM

I have a need to go through a set of DICOM files and modify certain tags to be current with the data maintained in the database of an external system. I am looking to use GDCM. I am new to GDCM. A search through stack overflow posts demonstrates that the anonymizer class can be used to change tag values.
Generating a simple CT DICOM image using GDCM
My question is if this is the best use of the GDCM API or if there is a better approach for changing the values of individual tags such as patient name or accession number. I am unfamiliar with all of the API options but have a link to the API documentation. It looks like the DataElement SetValue member could be used, but it doesn't appear that there is a valid constructor for doing this in the Value class. Any assistance would appreciated. This is my current approach:
Anonymizer anon = new Anonymizer();
anon.SetFile(myFile);
anon.Replace(new Tag(0x0010, 0x0010), "BUGS^BUNNY");
Quite late, but maybe it would be still useful. You have not mention if you write in C++ or C#, but I assume the latter, as you do not use pointers. Generally, your approach is correct (unless you use System.IO.File instead of gdcm.File). The value (second parameter of Replace function) has to be a plain string so no special constructor is needed. You should probably start with doxygen documentation of gdcm, and there is especially one complete example. It is in C++, but there should be no problems with translation.
There are two different ways to pad dicom tags:
Anonymizer
gdcm::Anonymizer anon;
anon.SetFile(file);
anon.Replace(gdcm::Tag(0x0002, 0x0013), "Implementation Version Name");
//Implementation Version Name
DatsElement
gdcm::Attribute<0x0018, 0x0088> ss;
ss.SetValue(10.0);
ds.Insert(ss.GetAsDataElement());

What is difference between LinkedHashSet and FilterSet(Guava)

When I trace legacy code, I found something very strange. I can get all the data values from LinkedHashSet, not from the other(FilterSet).
Although data can be seen in unfiltered, but in iteration, I cannot get the required data. Is it because of the predicate? How to get all the data from unfiltered ones?
I found that guava is used in the implementation of utilities class in my project.
What is the difference of these two sets? Any help is greatly appreciated.
Set<A<? extends B, ?>> attributes;
Sets.filter returns a private implementation type called FilteredSet that is a view of another set, restricting its output to only the elements of the original set that have some particular property.
There is deliberately no way to get out the original unfiltered data.

Share data between Activities/Presenters in GWT

II want to share data between Activities (which are my presenters) without passing the data with the Place. How can I do that?
If the data really isn't all that large I'd try and encode it in the Place: then your users can bookmark/distribute URLs that lead right into the guts of the application (link to a specific product, search filter, etc).
Quite some ways. A simple way is -
you could create a public static field in some class and use that in all of your presenters . (This method obviously has strings attached and must be used carefully)
Jai

XML Parser on MonoTouch?

I want to parse XML formatted string. How to use XML parser on MonoTouch?
Exactly the same way you would in standard C#.
Your options include:
XmlSerializer - good if you want to translate a full document to a set of C# objects
XmlDocument - good if the document is custom beyond XmlSerializer can handle
XPath - good for pulling out small pieces of data, if you don't care about the whole doc.
Linq2XML - another option using Linq.
Depending on what exactly you need.
You can use LINQ to XML in MonoTouch.
So,
var element = XElement.Parse("<cat>dog</cat>");
Console.WriteLine(element.Value);
prints "dog".
You canĀ“t use System.Xml.Linq in full, there will be a JIT part that will blow up when testing in the device, see Xamarin Monotouch limitations:
link