I am trying to add a connector of type realization between a component and interface, it works fine in EA 10 but in EA 12 I am getting an error that "Realization is not valid from Component -> Interface".
Is it a bug or they don't allow it in version 12 anymore?
My code is
private static void addRealization(Repository rep, Element sourceComponent)
{
EA.Element sourceComponentInterface = Database.Sql.getSourceComponentI(rep, sourceComponent.Name);
EA.Connector connector = sourceComponent.Connectors.AddNew("", "Realisation");
connector.SupplierID = sourceComponentInterface.ElementID;
connector.Update();
sourceComponent.Connectors.Refresh();
sourceComponentInterface.Connectors.Refresh();
}
Any Ideas?
Thanks
Related
I am using Eclipse to run my java programs but there is a problem with Eclipse's console that the input and output appears in the same console. For example
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while(t-- > 0) {
int n = scan.nextInt();
System.out.println(n);
}
scan.close();
}
For this code let the input be
2
3
4
then the output that i gets looks like
2
3
43
4
Is there any way to get separate input and output and get the distinction in eclipse.
One could re-assign System.in and/or System.out as discussed here.
Of course, this is not Eclipse-specific solution but a Java one.
I would be working with files in first place.
I'm trying to get steam app id and steam user id in my Unreal Engine 4 project in the following way:
if (SteamAPI_Init())
{
IOnlineSubsystem* ossBase = IOnlineSubsystem::Get();
FOnlineSubsystemSteam* oss = Cast<FOnlineSubsystemSteam*>(ossBase);
if (!oss) {
printText(TEXT("Steam Subsystem is down!"), FColor::Red.WithAlpha(255));
return;
}
auto SteamID = FString(std::to_string(SteamUser()->GetSteamID().ConvertToUint64()).c_str());
auto AppID = FString(std::to_string(oss->GetSteamAppId()).c_str());
But it is not possible to convert IOnlineSubsystem to FOnlineSubsystemSteam. So what is a correct way to obtain the instance of FOnlineSubsystemSteam?
The solution is to use static_cast:
FOnlineSubsystemSteam* oss = static_cast<FOnlineSubsystemSteam*>(ossBase);
This one works. It seems obvious to use UE4 Cast, but in this case it does not work.
I am an OPC-UA newbie integrating a non-OPC-UA system to an OPC-UA server using the Milo stack. Part of this includes writing values to Nodes in the OPC-UA server. One of my problems is that values from the other system comes in the form of a Java String and thus needs to be converted to the Node's proper data type. My first brute force proof-of-concept uses the below code in order to create a Variant that I can use to write to the Node (as in the WriteExample.java). The variable value is the Java String containing the data to write, e.g. "123" for an Integer or "32.3" for a Double. The solution now includes hard-coding the "types" from the Identifiers class (org.eclipse.milo.opcua.stack.core, see the switch statement) which is not pretty and I am sure there is a better way to do this?
Also, how do I proceed if I want to convert and write "123" to a node that is, for example,
UInt64?
try {
VariableNode node = client.getAddressSpace().createVariableNode(nodeId);
Object val = new Object();
Object identifier = node.getDataType().get().getIdentifier();
UInteger id = UInteger.valueOf(0);
if(identifier instanceof UInteger) {
id = (UInteger) identifier;
}
System.out.println("getIdentifier: " + node.getDataType().get().getIdentifier());
switch (id.intValue()) {
// Based on the Identifiers class in org.eclipse.milo.opcua.stack.core;
case 11: // Double
val = Double.valueOf(value);
break;
case 6: //Int32
val = Integer.valueOf(value);
break;
}
DataValue data = new DataValue(new Variant(val),StatusCode.GOOD, null);
StatusCode status = client.writeValue(nodeId, data).get();
System.out.println("Wrote DataValue: " + data + " status: " + status);
returnString = status.toString();
} catch (Exception e) {
System.out.println("ERROR: " + e.toString());
}
I've looked at Kevin's response to this thread: How do I reliably write to a OPC UA server? But I'm still a bit lost... Some small code example would really be helpful.
You're not that far off. Every sizable codebase eventually has one or more "TypeUtilities" classes, and you're going to need one here.
There's no getting around that fact that you need to be able to map types in your system to OPC UA types and vice versa.
For unsigned types you'll use the UShort, UInteger, and ULong classes from the org.eclipse.milo.opcua.stack.core.types.builtin.unsigned package. There are convenient static factory methods that make their use a little less verbose:
UShort us = ushort(foo);
UInteger ui = uint(foo);
ULong ul = ulong(foo);
I'll explore that idea of including some kind of type conversion utility for an upcoming release, but even with that, the way OPC UA works you have to know the DataType of a Node to write to it, and in most cases you want to know the ValueRank and ArrayDimensions as well.
You either know these attribute values a priori, obtain them via some other out of band mechanism, or you read them from the server.
Even though I have already changed the API Compatibility Level from .NET 2.0 Subset to .NET 2.0 in Edit->Project Settings->Player under Optimizations, upon upgrading to Unity 5.3.0 I am still getting the following two error messages:
`System.IO.File' does not contain a definition for `AppendText'
`System.IO.File' does not contain a definition for `CreateText'
They refer to the following code snippets:
using(StreamWriter writer = File.CreateText(saveFilePath))
{
string sLine = "time;joint;pos_x;pos_y;poz_z";
writer.WriteLine(sLine);
}
using(StreamWriter writer = File.AppendText(saveFilePath))
{
string sLine = string.Format("{0:F3};{1};{2:F3};{3:F3};{4:F3}", Time.time, (int)joint, jointPos.x, jointPos.y, jointPos.z);
writer.WriteLine(sLine);
}
How do I resolve this?
Are you tried this case?
using (var f = new StreamWriter("file path", true))
{
f.WriteLine("appended text");
f.Flush();
}
Hi,
public static String[][] excelRead() throws Exception{
FileInputStream fis=null;
HSSFWorkbook wb=null;
File excel=new File("C:\\MyEclipseWorkspace\\SeleniumWD\\Commodity1.xlsx");
fis=new FileInputStream(excel);
wb=new HSSFWorkbook(fis);
HSSFSheet ws=wb.getSheet("com");
int rowCount=ws.getLastRowNum()+1;
int colCount=ws.getRow(0).getLastCellNum();
String[][] data=new String[rowCount][colCount];
for(int i=0;i<rowCount;i++){
HSSFRow row=ws.getRow(i);
for(int j=0;j<colCount;j++){
HSSFCell cell=row.getCell(j);
String value= cellToString(cell);
data[i][j]=value;
System.out.println("Value is " +value);
}
}
return data;
}
I am working with selenium Eclipse and have to perform data driven testing. I wrote a code below to import an excel sheet data.
The below methods does so,
Now since i am executing this method it shows Source not found. I am not able to find the solution to this. I have already include poi-3.9.jar file in the library.
Please assists me regarding this.
Thanks in advance,