course.getCourseMaterialSets() is returning empty for Google classroom Course Material - google-classroom

To Access Course Material In Google Classroom API , I am using the following java library function. It was working last week but not returning any data now ? Any help would be greatly appreciated.
for (Course course : courses) {
System.out.printf("%s \n", course.getName());
List<CourseMaterialSet> set = course.getCourseMaterialSets();
if (set != null) {
for (CourseMaterialSet s : set) {
System.out.println(s.toPrettyString());
}
} else {
System.out.println("Course material not found");
}
}

Related

Validation in XText project

I'm trying to validate if an object access to the same place where it is instanced,
I have class Room and Door, room has doors and doors connect to rooms.
Code that I'm using is:
#Check
def void sameRoom(Room room) {
try {
var acu=0;
while (room.have!==null) {
var doors=room.have;
var nameRoom= room.name.toString() ;
for (element : doors) {
if (nameRoom.equals(element.access.name.toString())) {
acu++;
}
}
if (acu>0) {
error('Door can't address to the same place',
ProyectPackage.Literals.ROOM_HAVE,
"Same place")
}
}
} catch (Exception exception) {
System.out.println(exception.message);
}
}
When I execute this code, my cross references not appear and eclipse start to slow down

No Data Sources show in Google Fit

I am trying to record location and speed from the Sensors API in Google Fit in my Watch Face Service (Android Wear). Here's the code I use:
private void connectFitnessDataListeners() {
Fitness.SensorsApi.findDataSources(mGoogleApiClient,
new DataSourcesRequest.Builder()
.setDataTypes(DataType.TYPE_ACTIVITY_SAMPLE)
.setDataTypes(DataType.TYPE_LOCATION_SAMPLE)
.setDataTypes(DataType.TYPE_SPEED)
// Can specify whether data type is raw or derived.
.setDataSourceTypes(DataSource.TYPE_RAW)
.build())
.setResultCallback(new ResultCallback<DataSourcesResult>() {
#Override
public void onResult(DataSourcesResult dataSourcesResult) {
Log.i(TAG, "Find Data Sources: " + dataSourcesResult.getStatus().toString());
for (DataSource dataSource : dataSourcesResult.getDataSources()) {
//only include dataSources from the watch
Log.i(TAG, "Data source found: " + dataSource.toString());
Log.i(TAG, String.format("Data Source device %s and type: %s", dataSource.getDevice().toString(),dataSource.getDataType().getName()));
if (dataSource.getDevice() != Device.getLocalDevice(getBaseContext())) continue;
//FIXME: Turn this into a loop over an array
if (dataSource.getDataType().equals(DataType.TYPE_ACTIVITY_SAMPLE) && (mActivitySampleListener == null)) {
Log.i(TAG, "Data source for ACTIVITY_SAMPLE found! Registering.");
mActivitySampleListener = registerFitnessDataListener(dataSource, DataType.TYPE_ACTIVITY_SAMPLE);
} else if (dataSource.getDataType().equals(DataType.TYPE_LOCATION_SAMPLE) && (mLocationSampleListener == null)) {
Log.i(TAG, "Data source for LOCATION_SAMPLE found! Registering.");
mLocationSampleListener = registerFitnessDataListener(dataSource, DataType.TYPE_ACTIVITY_SAMPLE);
} else if (dataSource.getDataType().equals(DataType.TYPE_SPEED) && (mSpeedListener == null)) {
Log.i(TAG, "Data source for SPEED found! Registering.");
mSpeedListener = registerFitnessDataListener(dataSource, DataType.TYPE_SPEED);
}
}
}
}
);
}
However, when I run this in an otherwise working onConnected call, I get no DataSources in the for loop (the Find Data Sources log call shows success).
Any thoughts as to what I should pursue?
UPDATE:
If I remove the setDataSourceTypes restriction, I get only this:
Data source found: DataSource{derived:Application{com.google.android.gms::null}:Device{Sony:SmartWatch 3:15e991d4::3:2}::DataType{com.google.speed[speed(f)]}}
Data Source device Device{Sony:SmartWatch 3:15e991d4::3:2} and type: com.google.speed
So why don't I see location information from the GPS?
This was my developer error: setDataTypes takes a vararg set of DataTypes; in my example I was only setting DataType for TYPE_SPEED

Issue With Xamarin.Forms Images in iOS Renderer

I hope someone can help me with this weird problem.
I'm in Xamarin Forms, in a renderer. I'm passing a Xamarin.Forms.ImageSource into a ImageLoaderSourceHandler.
var_imageLoader = new ImageLoaderSourceHandler();
However, when I await the LoadImageAsync method it always returns null, rather than UIimage.
if (_view.Icon?.Source != null)
{
_iconImageView.Image =
await _imageLoader.LoadImageAsync(_view.Icon.Source);
}
My images are in the Resource directory and are BundleResourceas build action.
The file naming is correct (menu.png, menu#2x.png, menu#3x.png) and I've run out if ideas.
Anyone got a clue or two ?
Thanks
ImageLoaderSourceHandler is used if you want to download images from a Url.
Since your files are local you need to use FileImageSourceHandler
You can use this help method to get you the right type.
private static IImageSourceHandler GetHandler(ImageSource source)
{
IImageSourceHandler returnValue = null;
if (source is UriImageSource)
{
returnValue = new ImageLoaderSourceHandler();
}
else if (source is FileImageSource)
{
returnValue = new FileImageSourceHandler();
}
else if (source is StreamImageSource)
{
returnValue = new StreamImagesourceHandler();
}
return returnValue;
}

Attempt to de-reference a null object: Salesforce

I am trying to submit data to a server where it is picked and stored in salesforce. The error I am getting is "Attempt to de-reference a null object" at the server. so I am wondering what the problem is...
Below is the sample code:
public static List<String> processAgentVisitSurvey(ProcessSurveySubmission.SurveySubmission submission, Map<String, Submission_Answer__c> answers, Person__c person) {
// Load the TDR
TDR__c tdr = loadTdr(person);
if (tdr == null) {
//Send an email saying that an unregistered person is trying to act a TDR
// Send back the error message
return new String[] { '0', 'User with handset Id ' + submission.imei + ' is not a TDR', 'SUPRESSMSG' };
}
This is the source of the error message.
There is a class the redirects to this method:
private static List<String> additionalProcessing(
SurveySubmission surveySubmission,
Survey__c survey,
Person__c interviewer,
Id intervieweeId
) {
List<String> returnValues = new List<String>();
Map<String, Submission_Answer__c> answers = parseSubmissionToMap(surveySubmission);
// Find the name of the method that this survey hooks into to do its post processing
try {
if (survey.Post_Processing_Method__c.equalsIgnoreCase('None')) {
returnValues.add('0');
returnValues.add('There is no post processing method specified for this survey');
returnValues.add('SUPRESSMSG');
}
else if (survey.Post_Processing_Method__c.equals('CKW_Registration')) {
return CkwRegistration.processCkwRegistration(answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('CKW_Baseline')) {
return CkwRegistration.processCkwBaseline(answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('CKW_Staff_Update')) {
return CkwRegistration.processCkwUpdate(answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('Subcounty_Registration')) {
return CkwRegistration.processSubcounties(answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('TDR_AGENT_VISIT')) {
return TdrHelpers.processAgentVisitSurvey(surveySubmission, answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('UDOM_RAIN_GUAGE')) {
return UDoMSurveyProcessing.processDailyRainGauge(surveySubmission, answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('UDOM_RAIN_GUAGE_REG')) {
return UDoMSurveyProcessing.registerRainGauge(surveySubmission, answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('MTN_CHANNELS')) {
return MtnChannelsHelpers.processChannelsFFPSSurvey(surveySubmission, answers, interviewer);
}
else if (survey.Post_Processing_Method__c.equals('FHI_GROUP_REGISTRATION')) {
return FHISurveysHelpers.processGroupRegistration(surveySubmission, answers, interviewer, survey.Survey_Name__c);
}
else if (survey.Post_Processing_Method__c.equals('FHI_HOUSEHOLD_REGISTRATION')) {
return FHISurveysHelpers.processHouseholdRegistration(surveySubmission, answers, interviewer, survey.Survey_Name__c);
}
// else if (survey.Post_Processing_Method__c.equals('Colombia_Farmer_Registration')) {
// return ColombiaFarmerRegistrationPostProcessor.processSubmission(surveySubmission, answers, interviewer);
// }
else if (survey.Post_Processing_Method__c.equals('FIELD_OFFICER_SUPPORT')) {
return FieldOfficeHelpers.processFoSurvey(surveySubmission, answers, interviewer);
}
// else if (survey.Post_Processing_Method__c.equals('DATA_VALIDATOR_SPOT_CHECK')) {
// return DataValidatorHelpers.processSpotCheck(surveySubmission, answers, interviewer);
// }
// else if (survey.Post_Processing_Method__c.equals('DATA_VALIDATOR_BACK_CHECK')) {
// return DataValidatorHelpers.processBackCheck(surveySubmission, answers, interviewer);
// }
else if (survey.Post_Processing_Method__c.equals('EQUIPMENT_TRACKING')) {
return EquipmentTrackingHelpers.processFieldOfficerSubmission(surveySubmission, answers, interviewer);
}
}
catch (Exception e) {
returnValues.add('0');
returnValues.add(e.getMessage());
returnValues.add('An error occured. Please contact support');
}
return returnValues;
}
which I think is fine...
Please help coz I do not seem to see any problem
Thank you. I hope the code provide is enough.
Usually when I run across that error my first instinct is to look for any queries. In APEX when you return a null value (expected or not) into a single item such as Person__c person = [query that returns objects}; that error is thrown.
The SOLUTION is to ensure data gets returned into a concrete SObject such as...
List<Person__c> persons = [Here is a query or method call];
Then you would check the list with persons.size() This obeys salesforce's Bulkify everything approach they enforce as well as a more robust backend.
Sorry I couldn't provide more support, the error wasn't very evident in your code samples without a line number or debug log.
Good Luck!
Be aware: This error can also appear if you are trying to reference an uninstantiated property of a class.
Example: If you declare a List property of a class, but never instantiate it, and then attempt to add to that list, you will get this error.

IE & Ajax / XPath

I've read countless threads and tried implementing many different suggestions, but haven't had any luck.
first:
function ajaxRequest() {
try {
var request = new XMLHttpRequest();
}
catch(e1) {
try {
var request = new ActiveXObject("Msxml2.HTMLHTTP");
}
catch(e2) {
try {
var request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e3) {
var request = false;
}
}
}
return request;
}
It looks like IE is successfully using XMLHttpRequest. As far as I can tell, it's loading the XML fine, but Xpath is another story:
function XMLPath(doc, path) {
try {
return doc.evaluate(path, doc, null, XPathResult.STRING_TYPE, null).stringValue;
} catch (e) {
try {
doc.setProperty("SelectionLanguage", "XPath");
return doc.selectNodes(path);
}
catch(e2) {
alert(e2);
}
}
}
Basically, what must I change in my catch statement to make it work with IE? What's also interesting is that it never alerts an e2 error, meaning it's not actually throwing an error. Totally confused.
Thanks.
Try return doc.selectSingleNode(path).text; for IE, that is the closest you can get for accessing the string value of the node found by your path.

Resources