Approach 1:
final ClientCredentialProvider clientCredentialProvider = new ClientCredentialProvider(
client_id,
ImmutableList.of("https://graph.microsoft.com/.default"),
secret,
tenant,
NationalCloud.Global
);
IGraphServiceClient graphClient = com.microsoft.graph.requests.extensions.GraphServiceClient
.builder()
.authenticationProvider(clientCredentialProvider)
.buildClient();
Approach 2:
final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
.clientId(client_id)
.clientSecret(secret)
.tenantId(tenant)
.build();
authProvider = new TokenCredentialAuthProvider(clientSecretCredential);
// Build a Graph client
GraphServiceClient<Request> graphClient = GraphServiceClient.builder()
.authenticationProvider(authProvider)
.buildClient();
Related
Left side table is distorted while comparing two HTML table data using daisydiff.jar.
I need your support to fix this issue. Thanks in advance
Using below code
StringWriter finalResult = new StringWriter();
SAXTransformerFactory tf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler result = tf.newTransformerHandler();
result.getTransformer().setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
result.getTransformer().setOutputProperty(OutputKeys.INDENT, "no");
result.getTransformer().setOutputProperty(OutputKeys.METHOD, "html");
result.getTransformer().setOutputProperty(OutputKeys.ENCODING, "UTF-8");
result.setResult(new StreamResult(finalResult));
ContentHandler postProcess = result;
Locale locale = Locale.getDefault();
String prefix = "diff";
NekoHtmlParser cleaner = new NekoHtmlParser();
InputSource oldSource = new InputSource (new String reader(html1));
InputSource newSource = new InputSource (new String reader(html2));
DomTreeBuilder oldHandler = new DomTreeBuilder ();
cleaner.parse(oldSource, oldHandler);
TextNodeComparator leftComparator = new TextNodeComparator (oldHandler, locale);
DomTreeBuilder newHandler = new DomTreeBuilder ();
cleaner.parse(newSource, newHandler);
TextNodeComparator rightComparator = new TextNodeComparator (newHandler, locale);
HtmlSaxDiffOutput output = new HtmlSaxDiffOutput (postProcess, prefix);
HTMLDiffer differ = new HTMLDiffer(output);
differ.diff(leftComparator, rightComparator);
I want to create a chart using amchart in windows phone application.This is my code when i run i have this message"Can not implicitly convert type 'string' to 'System.Windows.Media.Brush"how can i solve this
InitializeComponent();
XDocument data = XDocument.Load("Data.xml");
var results = from query in data.Descendants("year")
select new ResultModel((string)query.Element("month"),
(int)query.Element("actual"));
var chart = new SerialChart
{
CategoryValueMemberPath = "month",
AxisForeground="White",
PlotAreaBackground="Black",
GridStroke="DarkGray"
};
chart.SetBinding(SerialChart.DataSourceProperty, new Binding("results"));
var lineGraph = new LineGraph
{
Title = "Sales",
ValueMemberPath = "actual",
};
chart.Graphs.Add(lineGraph);
sta.Children.Add(chart);
}
The properties in SerialChart, such as AxisForeground, PlotAreaBackground, GridStroke, their type is Brush. So you can set it like:
AxisForeground = new SolidColorBrush(Colors.White);
PlotAreaBackground = new SolidColorBrush(Colors.Black);
GridStroke = new SolidColorBrush(Colors.DarkGray);
I have researched for this issue and am unable to find a solution.
The SO post TimeZone change to UTC while updating the Appointment referred to the same problem, but I've tested the solution and its not working.
Here is what's wrong:
Does anyone have a solution? The time is correctly reflected on Outlook, Emails etc. It's just that the text shown is misleading to people and causing confusion.
*Note that the code below can be copied and pasted into a console app for testing.
var timezone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
var service = new ExchangeService(ExchangeVersion.Exchange2013, timezone);
service.Credentials = new NetworkCredential("myemail#mydomain.com", "mypassword");
service.Url = new Uri("https://outlook.office365.com/Ews/Exchange.asmx");
var meeting1 = new Appointment(service);
meeting1.Subject = "Test Meeting";
meeting1.Body = "Test body";
meeting1.Start = new DateTime(2013, 8, 22, 9, 0, 0); //my default time is GMT+8
meeting1.End = meeting1.Start.AddHours(2);
meeting1.Location = "Conf Room";
meeting1.RequiredAttendees.Add("someone#outlook.com");
meeting1.Save(SendInvitationsMode.SendToAllAndSaveCopy);
Console.WriteLine("1st invite sent");
var id = meeting1.Id.ToString();
System.Threading.Thread.Sleep(5000); //break for a while...
//re-fetch the appointment
var meeting2 = Appointment.Bind(service, new ItemId(id),
new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Start,
AppointmentSchema.End, AppointmentSchema.StartTimeZone,
AppointmentSchema.EndTimeZone, AppointmentSchema.TimeZone));
Console.WriteLine( meeting2.StartTimeZone ); //shows Tokyo Standard Time correctly.
meeting2.StartTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
meeting2.EndTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
meeting2.Start = new DateTime(2013,8,23, 9,0,0, DateTimeKind.Unspecified);
meeting2.End = meeting2.Start.AddHours(2);
meeting2.Subject = "Updated Test Meeting";
meeting2.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);
meeting2.Load(new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Start,
AppointmentSchema.End, AppointmentSchema.StartTimeZone,
AppointmentSchema.EndTimeZone, AppointmentSchema.TimeZone,
AppointmentSchema.Body, AppointmentSchema.NormalizedBody,AppointmentSchema.TextBody));
Console.WriteLine( meeting2.StartTimeZone ); //shows Tokyo Standard Time correctly.
I've been having the same issue as we're using ExchangeVersion.Exchange2010_SP2 but i'm managed to get round this using:
appointment.Save(SendInvitationsMode.SendToNone);
// to fix the issue of updating appointment sets timezone to UTC, we use ExchangeVersion.Exchange2007_SP1
service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.UseDefaultCredentials = false;
service.Credentials = new WebCredentials(Account, Password);
service.Url = new Uri(url);
service.Timeout = 600000;
My code is below. This is cascading code.
And it has 8 jobs. I don't know how to configure every job.
Code below configure 8 jobs togerher.
But what i want to do is let last job one reduce.
I want to ask how to recoginse this 8 jobs, and how to configure them seperatly?
thanks.
private static void Demo(String[] args) {
/* Tap sourceTap = new Hfs(new TextLine(), "D:/test/file");
Tap finalResultTap = new Hfs(new TextLine(), "D:/test/result", true);
*/
Tap sourceTap = new Hfs(new TextLine(), args[0], SinkMode.KEEP);
Tap finalResultTap = new Hfs(new TextLine(), args[1], SinkMode.REPLACE);
Tap trap = new Hfs(new TextLine(), args[2], SinkMode.REPLACE);
Pipe sourcePipe = new Pipe("sourcePipe");
sourcePipe = getFilterPipe(sourcePipe);
Pipe vvResultPipe = new Pipe("vvResultPipe", sourcePipe);
vvResultPipe = getVVResultPipe(sourcePipe);
Pipe clickResultPipe = new Pipe("clickResultPipe", sourcePipe);
clickResultPipe = getClickResultPipe(clickResultPipe);
Pipe stClickResultPipe = new Pipe("stClickResultPipe", sourcePipe);
stClickResultPipe = getStClickResultPipe(sourcePipe);
//连接3个pipe的结果
Pipe resultPipe = new Pipe("resultPipe");
resultPipe = new CoGroup(vvResultPipe, new Fields("vid"), clickResultPipe, new Fields("referVid"),
new Fields("vid", "totalVV", "referVid", "totalClick"), new LeftJoin());
resultPipe = new CoGroup(resultPipe, new Fields("vid"), stClickResultPipe, new Fields("referVid"),
new Fields("vid", "totalVV", "referVid", "totalClick", "referVid2", "st1","st2","st3", "st4","st6", "st8"), new LeftJoin());
resultPipe = new Each(resultPipe, new Fields("vid", "totalVV", "totalClick", "st1","st2","st3", "st4","st6", "st8"),
new Identity(Fields.ARGS));
Fields sortClickFields = new Fields("totalVV");
resultPipe = new GroupBy(resultPipe, Fields.NONE, sortClickFields );
sortClickFields.setComparators(Collections.reverseOrder());
/* Limit limit = new Limit(200);
resultPipe = new Each(resultPipe, limit);
*/
JobConf conf = new JobConf();
conf.setJarByClass(Main.class);
//Properties properties = new Properties();
Properties properties = AppProps.appProps().buildProperties(conf);
properties.setProperty("user.group", "d_sdo_data");
properties.setProperty("mapred.job.queue.name", "cug_d_sdo_data");
properties.setProperty("mapred.fairscheduler.pool", "cug_d_sdo_data");
properties.setProperty("cascading.tmp.dir", "/home/hdfs/cluster-data/tmp/mapred/staging/recommend_user/tmp");
properties.setProperty("mapreduce.job.complete.cancel.delegation.tokens", "false");
properties.setProperty("mapred.reduce.tasks", "30");
properties.setProperty("mapred.map.tasks", "200");
//AppProps.setApplicationJarClass(properties, Main.class);
FlowConnector flowConnector = new HadoopFlowConnector(properties);
FlowDef flowDef = FlowDef.flowDef()
.setName( "tfidf" )
.addSource( sourcePipe, sourceTap )
.addTailSink( resultPipe, finalResultTap )
.addTrap( "assertions", trap );
Flow flow = flowConnector.connect(flowDef);
flow.complete();
}
This question is three years old, but I ran across it while looking for this solution. Here's what I finally ended up with:
pipe.getStepConfigDef().setProperty("mapreduce.job.reduces", "1");
This goes after you've defined the step you want to configure.
Note that this is for Hadoop 2.6.4 - if you're using mapred.reduce.tasks property instead. See here:
https://hadoop.apache.org/docs/r2.6.4/hadoop-project-dist/hadoop-common/DeprecatedProperties.html
I want to subscribe report on specific schedule in reporting services 2008. i.e report will dilever to user automatically on schedule. I am using visual studio 2008. I have done the configuration setting (rsreportserver.config, app.config after adding refrences of asmx files) by refrence msdn. The code is running fine (no exception occur) and I also get subscription id through calling create subscription indicate all going fine. But after running the code no entry made in Subscription table of ReportServer database. And also not get any mail. While through report server web tool, I can get email and also entery made in database but not from coe. Please someone help me. What I am missing. Plz help
Code is given follow: (Keep in mind, I am using VS2008)
void SendReportEmail()
{
RSServiceReference.ReportingService2005SoapClient rs=new RSServiceReference.ReportingService2005SoapClient();
rs.ClientCredentials.Windows.AllowedImpersonationLevel = new System.Security.Principal.TokenImpersonationLevel();
string batchID = string.Empty;
RSServiceReference.ServerInfoHeader infoHeader = rs.CreateBatch(out batchID);
BatchHeader bh = new BatchHeader()
{
BatchID = batchID,
AnyAttr = infoHeader.AnyAttr
};
string report = "/PCMSR6Reports/PaymentRequestStatusMIS";
string desc = "Send email from code to Hisham#comsoft.com";
string eventType = "TimedSubscription";
string scheduleXml="<ScheduleDefinition xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><StartDateTime xmlns=\"http://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices\">2010-03-06T15:15:00.000+05:00</StartDateTime></ScheduleDefinition>";
RSServiceReference.ParameterValue[] extensionParams = new RSServiceReference.ParameterValue[7];
extensionParams[0] = new RSServiceReference.ParameterValue();
extensionParams[0].Name = "TO";
extensionParams[0].Value = "Hisham#comsoft.com";
extensionParams[1] = new RSServiceReference.ParameterValue();
extensionParams[1].Name = "IncludeReport";
extensionParams[1].Value = "True";
extensionParams[2] = new RSServiceReference.ParameterValue();
extensionParams[2].Name = "RenderFormat";
extensionParams[2].Value = "MHTML";
extensionParams[3] = new RSServiceReference.ParameterValue();
extensionParams[3].Name = "Subject";
extensionParams[3].Value = "#ReportName was executed at #ExecutionTime";
extensionParams[4] = new RSServiceReference.ParameterValue();
extensionParams[4].Name = "Comment";
extensionParams[4].Value = "Here is your test report for testing purpose";
extensionParams[5] = new RSServiceReference.ParameterValue();
extensionParams[5].Name = "IncludeLink";
extensionParams[5].Value = "True";
extensionParams[6] = new RSServiceReference.ParameterValue();
extensionParams[6].Name = "Priority";
extensionParams[6].Value = "NORMAL";
RSServiceReference.ParameterValue[] parameters = new RSServiceReference.ParameterValue[10];
parameters[0] = new RSServiceReference.ParameterValue();
parameters[0].Name = "BranchId";
parameters[0].Value = "1";
parameters[1] = new RSServiceReference.ParameterValue();
parameters[1].Name = "UserName";
parameters[1].Value = "admin";
parameters[2] = new RSServiceReference.ParameterValue();
parameters[2].Name = "SupplierId";
parameters[2].Value = "0";
string matchData = scheduleXml;
RSServiceReference.ExtensionSettings extSettings = new RSServiceReference.ExtensionSettings();
extSettings.ParameterValues = extensionParams;
extSettings.Extension = "Report Server Email";
try
{
string sub="";
RSServiceReference.ServerInfoHeader SubID = rs.CreateSubscription(bh, report, extSettings, desc, eventType, matchData, parameters, out sub);
rs.FireEvent(bh, "TimedSubscription", sub);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
Detail response will be highly appricated.
Try adding # at the beginning of your xml string #"