so im making a drawing app and i have a last error - intellisense. This is the error:
IntelliSense: no instance of overloaded function "System::Drawing::Graphics::DrawLine" matches the argument list
argument types are: (System::Drawing::SolidBrush, System::Drawing::Point, System::Drawing::Point)
object type is: System::Drawing::Graphics
This is the code/ line:
g->DrawLine(SolidBrush(colorSel), oldPosition, e->Location);
Related
I'm trying to use PySpark's split() method on a column that has data formatted like:
[6b87587f-54d4-11eb-95a7-8cdcd41d1310, 603, landing-content, landing-content-provider]
my intent is to extract the 4th element after the last comma.
I'm using a syntax like:
mydf.select("primary_component").withColumn("primary_component_01",f.split(mydf.primary_component, "\,").getItem(0)).limit(10).show(truncate=False)
But I'm consistently getting this error:
"cannot resolve 'split(mydf.primary_component, ',')' due to data
type mismatch: argument 1 requires string type, however,
'mydf.primary_component' is of
structuuid:string,id:int,project:string,component:string
type.;;\n'Project [primary_component#17,
split(split(primary_component#17, ,)[1], \,)...
I've also tried escaping the "," using \, \\ or not escaping it at all and this doesn't make any difference. Also, removing the ".getItem(0)" produces no difference.
What am I doing wrong? Feeling a dumbass but I don't know how to fix this...
Thank you for any suggestions
You are getting the error:
"cannot resolve 'split(mydf.`primary_component`, ',')' due to data
type mismatch: argument 1 requires string type, however,
'mydf.`primary_component`' is of
struct<uuid:string,id:int,project:string,component:string>
because your column primary_component is using a struct type when split expects string columns.
Since primary_component is already a struct and you are interested in the value after your last comma you may try the following using dot notation
mydf.withColumn("primary_component_01","primary_component.component")
In the error message, spark has shared the schema for your struct as
struct<uuid:string,id:int,project:string,component:string>
i.e.
column
data type
uuid
string
id
int
project
string
component
string
For future debugging purposes, you may use mydf.printSchema() to show the schema of the spark dataframe in use.
Kubernetes-client/go - trying this example
Note: I am using go.mod file
Do you know why I get this Azure error?
go run .
# github.com/kubernetes-client/go/kubernetes/config
../../gopath/pkg/mod/github.com/kubernetes-client/go#v0.0.0-20190402190921-ee48eb4f6eed/kubernetes/config/azure.go:63:3: cannot use l.user.AuthProvider.Config["expires-in"] (type string) as type json.Number in field value
../../gopath/pkg/mod/github.com/kubernetes-client/go#v0.0.0-20190402190921-ee48eb4f6eed/kubernetes/config/azure.go:64:3: cannot use l.user.AuthProvider.Config["expires-in"] (type string) as type json.Number in field value
I'm trying to use a string variable as input to an xml function. When I use this command:
name2_node(i).setTextContent('truck');
there is no error. But when I replace it with:
name2_node(i).setTextContent(type(i,1));
an error occurs like this:
No method 'setTextContent' with matching signature found for class
'org.apache.xerces.dom.ElementImpl'.
The variable type is a string array. In fact when I type type(i,1) in command window the result is:
ans =
string
"truck"
What part am I doing wrong?
Two things:
use a different variable name, type is a built in function which tells you the variable type, hence why it shows "string" in the output.
Then access the cell array of strings with curly braces
vehicletypes = {'car'; 'truck'; 'van'};
name2_node(i).setTextContent(vehicletypes{i,1}); % For i=2, this passes 'truck'
Excel workbooks have a CustomDocumentProperties collection. This collection is of type DocumentProperties and has an Add method that I'm attempting to call from MATLAB.
If I call the invoke method on the collection I see:
>> workbook.CustomDocumentProperties.invoke
Item = handle Item(handle, Variant, int32)
Add = handle Add(handle, string, bool, int32, Variant(Optional))
I assume this means the Add method requires a string, boolean, int32, and an optional variant, and this matches with the Microsoft documentation for the Add method.
However, all combination of inputs I've tried to this function result in an error. For example:
workbook.CustomDocumentProperties.Add('MyProp', true, int32(1), true);
Results in the error:
Invoke Error: Incorrect number of arguments
If I supply 7 or more arguments then I get the error:
Error: Invalid number is arguments. This method can take maximum 6 arguments
If I supply anything other than a string as the first argument I get the error:
No method 'Add' with matching signature found for class 'Interface.2DF8D04D_5BFA_101B_BDE5_00AA0044DE52'.
Has anyone successfully used this function to add a custom property to an Excel workbook from MATLAB?
class x{
public static void main(String[] args){
String x="<html><head></head></html>";
String arr[]=x.split("<head>");
String script="hi";
x=arr[0]+"<head>"+script+arr[1];
System.out.println(x);
}
}
the above code when compiled as a java file compiles fine but when used a s a groovy file spits the error :
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
D:\Garage\groovy-binary-1.7.1\groovy-1.7.1\bin\x.groovy: 4: Apparent variable 'a
rr' was found in a static scope but doesn't refer to a local variable, static fi
eld or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable fro
m a static context.
You misspelled a classname or statically imported field. Please check the spelli
ng.
You attempted to use a method 'arr' but left out brackets in a place not allowed
by the grammar.
# line 4, column 10.
String arr[]=x.split("");
^
D:\Garage\groovy-binary-1.7.1\groovy-1.7.1\bin\x.groovy: 6: Apparent variable 'a
rr' was found in a static scope but doesn't refer to a local variable, static fi
eld or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable fro
m a static context.
You misspelled a classname or statically imported field. Please check the spelli
ng.
You attempted to use a method 'arr' but left out brackets in a place not allowed
by the grammar.
# line 6, column 5.
x=arr[0]+""+script+arr[1];
^
D:\Garage\groovy-binary-1.7.1\groovy-1.7.1\bin\x.groovy: 6: Apparent variable 'a
rr' was found in a static scope but doesn't refer to a local variable, static fi
eld or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable fro
m a static context.
You misspelled a classname or statically imported field. Please check the spelli
ng.
You attempted to use a method 'arr' but left out brackets in a place not allowed
by the grammar.
# line 6, column 28.
x=arr[0]+""+script+arr[1];
^
3 errors
D:\Garage\groovy-binary-1.7.1\groovy-1.7.1\bin>
It works if you move the [] to the String side like so:
String[] arr = x.split("<head>");