Error C#.NET 3.0: The best overloaded method match for 'CreatePageSection(ref string, ref string, ref object)' has some invalid arguments - c#-3.0

I have got the following problem. I encountered an error regarding the default parameters. I added a simple piece of code for an overload. Now I get in the new code (line 3: CreatePageSection(sItemID, "", null);) gives the error mentioned in the title.
I looked for the answer in the other topics, but I can't find the problem. Can someone help me?
The code is found here:
public void CreatePageSection(ref string sItemID)
{
CreatePageSection(sItemID, "", null);
}
public void CreatePageSection(ref string sItemID, ref string sFrameUrl, ref object vOnReadyState)
{
if (Strings.InStr(msPresentPageSections, "|" + sItemID + "|", 0) > 0) {
return;
}
msPresentPageSections = msPresentPageSections + sItemID + "|";
string writeHtml = "<div class=" + MConstants.QUOTE + "PageSection" + MConstants.QUOTE + " id=" + MConstants.QUOTE + "Section" + sItemID + "Div" + MConstants.QUOTE + " style=" + MConstants.QUOTE + "display: none;" + MConstants.QUOTE + ">";
this.WriteLine_Renamed(ref writeHtml);
//UPGRADE_WARNING: Couldn't resolve default property of object vOnReadyState. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
//UPGRADE_NOTE: IsMissing() was changed to IsNothing_Renamed(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="8AE1CB93-37AB-439A-A4FF-BE3B6760BB23"'
writeHtml = " <iframe id=" + MConstants.QUOTE + sItemID + "Frame" + MConstants.QUOTE + " name=" + MConstants.QUOTE + sItemID + "Frame" + MConstants.QUOTE + " frameborder=" + MConstants.QUOTE + "0" + MConstants.QUOTE + (!string.IsNullOrEmpty(sFrameUrl) ? " src=" + MConstants.QUOTE + sFrameUrl + MConstants.QUOTE : "") + ((vOnReadyState == null) ? "" : " onreadystatechange=" + MConstants.QUOTE + Convert.ToString(vOnReadyState) + MConstants.QUOTE) + ">";
this.WriteLine_Renamed(ref writeHtml);
writeHtml = " </iframe>";
this.WriteLine_Renamed(ref writeHtml);
writeHtml = "</div>";
this.WriteLine_Renamed(ref writeHtml);
}

you must pass params by reference
public void CreatePageSection(ref string sItemID)
{
var missingString = String.Empty;
object missingObject = null;
CreatePageSection(ref sItemID, ref missingString, ref missingObject);
}

Since your are not manipulating sFrameUrl and vOnReadyState, remove the ref keyword from those parameters.
See: http://msdn.microsoft.com/en-us/library/14akc2c7(v=vs.71).aspx
hth
Mario

Related

Selecting sql data with multiple rows and exporting as xml file

I have this JavaScript in my transformer
var dbConn;
try {
dbConn = DatabaseConnectionFactory.createDatabaseConnection($gc('DataWarehouseXMLDataConfig').sqlDriver,
$gc('DataWarehouseXMLDataConfig').sqlConnString,
$gc('DataWarehouseXMLDataConfig').sqlUsername,
$gc('DataWarehouseXMLDataConfig').sqlPassword);
var data = dbConn.executeCachedQuery('EXEC [dbo].[GetDataWarehouseData]');
var xml = "";
var xml2 = "";
var row = "";
while(data.next()) {
row = '<referral>' + '\n' +
'<careid>' + data.getString('careid') + '</careid>' + '\n' +
'<patientid>' + data.getString('patientid') + '</patientid>' + '\n' +
'<dateofreceipt>' + data.getString('dateofreceipt') + '</dateofreceipt>' + '\n' +
'<datefirstseen>' + data.getString('datefirstseen') + '</datefirstseen>' + '\n' +
'<nhsnumber>' + data.getString('nhsnumber') + '</nhsnumber>' + '\n' +
'<hospitalnumber>' + data.getString('hospitalnumber') + '</hospitalnumber>' + '\n' +
'<surname>' + data.getString('surname') + '</surname>' + '\n' +
'<forename>' + data.getString('forename') + '</forename>' + '\n' +
'<dateofbirth>' + data.getString('dateofbirth') + '</dateofbirth>' + '\n' +
'</referral>';
xml = xml + row;
xml2 = '<?xml version="1.0" encoding="utf-8"?>' + '\n' + '<results>' + xml + '</results>';
}
channelMap.put('xml2', xml2);
} finally {
if (dbConn) {
dbConn.close();
}
}
I'm using this outbound message template
<referral>
<careid></careid>
<patientid></patientid>
<dateofreceipt></dateofreceipt>
<datefirstseen></datefirstseen>
<nhsnumber></nhsnumber>
<hospitalnumber></hospitalnumber>
<surname></surname>
<forename></forename>
<dateofbirth></dateofbirth>
</referral>
I have a File Writer destination and the File Name has a .xml extension.
My template in the File Writer is ${XmlUtil.prettyPrint(${message.encodedData})}.
The SQL data is being retrieved ok.
I don't think I'm a million miles away but I'm doing something fundamentally wrong.
What do I need to do to send the required xml file please?
I fixed this by adding a mapping step to the source transformer and using JavaScript, like
tmp['referral']['dateofbirth'] = msg['dateofbirth'].toString();

Azure Data Explorer Metrics

how can i get the "CacheUtilization" metric from "Azure Data Explorer" using java. Are there any JAVA SDKs that help fetch the metrics from "Azure Data Explorer" service?
Regarding the issue, please refer to the following code
Maven
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-resources</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-monitor</artifactId>
<version>2.2.0</version>
</dependency>
code
String clientId="";
String clientSecret="";
String tenant="";
String subId="";
AzureProfile profile = new AzureProfile(tenant,subId,AzureEnvironment.AZURE);
TokenCredential credential = new ClientSecretCredentialBuilder()
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
.tenantId(tenant)
.clientId(clientId)
.clientSecret(clientSecret)
.build();
MonitorManager manager = MonitorManager
.configure()
.withLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)
.authenticate(credential,profile);
OffsetDateTime recordDateTime = OffsetDateTime.now();
for (MetricDefinition metricDefinition : manager.metricDefinitions().listByResource("<the resource id of data exploer>")
) {
if(metricDefinition.name().localizedValue().equalsIgnoreCase("Cache utilization")){
MetricCollection metricCollection = metricDefinition.defineQuery()
.startingFrom(recordDateTime.minusDays(7))
.endsBefore(recordDateTime)
.withAggregation("Average")
.withInterval(Duration.ofMinutes(5))
.filterByNamespace("microsoft.kusto/clusters")
.execute();
System.out.println("Metrics for '" + "" + "':");
System.out.println("Namespacse: " + metricCollection.namespace());
System.out.println("Query time: " + metricCollection.timespan());
System.out.println("Time Grain: " + metricCollection.interval());
System.out.println("Cost: " + metricCollection.cost());
for (Metric metric : metricCollection.metrics()) {
System.out.println("\tMetric: " + metric.name().localizedValue());
System.out.println("\tType: " + metric.type());
System.out.println("\tUnit: " + metric.unit());
System.out.println("\tTime Series: ");
for (TimeSeriesElement timeElement : metric.timeseries()) {
System.out.println("\t\tMetadata: ");
for (MetadataValueInner metadata : timeElement.metadatavalues()) {
System.out.println("\t\t\t" + metadata.name().localizedValue() + ": " + metadata.value());
}
System.out.println("\t\tData: ");
for (MetricValue data : timeElement.data()) {
System.out.println("\t\t\t" + data.timestamp()
+ " : (Min) " + data.minimum()
+ " : (Max) " + data.maximum()
+ " : (Avg) " + data.average()
+ " : (Total) " + data.total()
+ " : (Count) " + data.count());
}
}
}
break;
}
}

twilio API issues when submitting whastapp query

I'm using HttpURLConnection to post to https://api.twilio.com/2010-04-01/Accounts/****/Messages.json
this works for SMS - but when the txtTo and txtFrom are changed to To=whatsapp:+12345567&From=whatsapp:+123456778&Body=sacsacsac
it stops working ..... any ideas?
String message = "To=" + txtTo + "&From=" + txtFrom + "&Body=" + txtBody;
byte[] postData = message.getBytes( StandardCharsets.UTF_8 );
String message = "From=" + URLEncoder.encode("whatsapp:" + txtFrom, "UTF-8") +"&Body=" + URLEncoder.encode(txtBody, "UTF-8") + "&To=" + URLEncoder.encode("whatsapp:" + txtTo, "UTF-8");

FabricJS Android Webview Newlines showing as \n

So I load a basic page with the canvas and everything seems to work except newlines are shown as \n
here is the body as a java method:
input = StringEscapeUtils.unescapeShell(this.getData());
private String htmlBody(String input){
return "<html><head>" +
"<link href=\"fonts.css\" type=\"text/css\" rel=\"stylesheet\" />" +
"<script src=\"jquery.min.js\" type=\"text/javascript\"></script>" +
"<script src=\"fontfaceobserver.js\" type=\"text/javascript\"></script>" +
"<script src=\"fabric.min.js\" type=\"text/javascript\"></script>" +
"<style type=\"text/css\">" +
".canvas-container {" +
"margin: 0 auto;" +
"}"+
"</style>" +
"<script src=\"javascript_fabric.js\" type=\"text/javascript\"></script>" +
"</head><body>"+
"<div id=\"sb2div\" class=\"row\" style=\"margin: 0 auto!important; max-height: 100vh\">" +
"<canvas id=\"fabricjs-branding\" width=\"600\" height=\"600\" style=\"margin: auto!important;\"></canvas>" +
"</div>" +
"<script>" +
"$(document).ready(function(){" +
"setUpBranding();" +
"var o = " + input + ";" +
"console.log(o);" +
"fabricjscanvas.loadFromJSON(o);"+
"});" +
"</script>" +
"</body></html>";
}
setUpBranding() does my initialization of fabricjscanvas which does add some feature prototypes but the issue has nothing to do with them.
itext and textbox are standard using the current release 4
on the desktop using the same setup everything is fine...
based on a comment i found the newline characters were not getting unescaped with the rest of the json data... strange but I was able to fix it using the Java String Replace method... after using the StringEscapeUtils.unescapeShell
input = StringEscapeUtils.unescapeShell(this.getData());
input = input.replace("\\\\n", "\\n");

Getting Object tag value in AWS S3

I am using scala to get information about my objects that are in S3 I am intersted in getting each object I have inside S3 Bucket his tag value so far I have accomplished this code to get me information about my objects but did not succeeded in getting its tagging value: I used this code in scala:
def retrieveObjectTags(keyName: String): Unit ={
try {
println("Listing objects")
val req: ListObjectsV2Request =
new ListObjectsV2Request().withBucketName(bucketName).withMaxKeys(2)
var result: ListObjectsV2Result = null
do {
result = client.listObjectsV2(req)
for (objectSummary <- result.getObjectSummaries) {
println(
" - " + objectSummary.getKey + " " + "(size = " + objectSummary.getSize +
")")
println(objectSummary.getETag)
}
println("Next Continuation Token : " + result.getNextContinuationToken)
req.setContinuationToken(result.getNextContinuationToken)
} while (result.isTruncated == true);
}catch {
case ase: AmazonServiceException => {
println(
"Caught an AmazonServiceException, " + "which means your request made it " +
"to Amazon S3, but was rejected with an error response " +
"for some reason.")
println("Error Message: " + ase.getMessage)
println("HTTP Status Code: " + ase.getStatusCode)
println("AWS Error Code: " + ase.getErrorCode)
println("Error Type: " + ase.getErrorType)
println("Request ID: " + ase.getRequestId)
}
case ace: AmazonClientException => {
println(
"Caught an AmazonClientException, " + "which means the client encountered " +
"an internal error while trying to communicate" +
" with S3, " +
"such as not being able to access the network.")
println("Error Message: " + ace.getMessage)
}
}
// val getTaggingRequest = new GetObjectTaggingRequest(bucketName,keyName)
// var getTagResult = client.getObjectTagging(getTaggingRequest)
//println(getTaggingRequest)
var tag: Tag = new Tag()
println("tag name:" + tag.getValue)
}
as for the remarked lines I have encounter a problem with it, what other way I can use to solve this problem?