Angular-dart: "target of URI..." - eclipse

I searched high and low for this issue and, while I found reports of the same error ubiquitously, I didn't find this specific error and can't seem to resolve it. I'm just now learning Dart and am following the Angular-Dart tutorial, and I keep getting this error early on, with no explanation that I can find. This is my badge_controller file:
library s1_basics.badge_controller;
import 'package:angular/angular.dart';
#NgController(
selector: '[badge-controller]',
publishAs: 'ctrl'
)
class BadgeController {
static const DEFAULT_NAME = 'Anne Bonney';
static const LABEL1 = 'Arrr! Write yer name!';
static const LABEL2 = 'Aye! Gimme a name!';
String name = '';
bool get inputIsNotEmpty => name.trim().isNotEmpty;
String get label => inputIsNotEmpty ? LABEL1 : LABEL2;
generateName() {
name = DEFAULT_NAME;
}
}
And this is my pirate_module file:
library s1_basics.pirate_module;
import 'package:angular/angular.dart';
import 'package:s1_basics/badge_controller.dart';
class PirateModule extends Module {
PirateModule() {
type(BadgeController);
}
}
I'm so early on in this tutorial that I don't think there's much else that I can show to debug this, but if anyone has an idea, I'd greatly appreciate it. Cheers!

Changing the import paths to be relative references for the imported files seems to fix it; i.e. initially this gave errors:
import 'package:s1_basics/pirate_module.dart';
but after changing it to
import '../lib/pirate_module.dart';
it worked...so that's the fix (for this) if anyone out there has issues.

Related

youtube_explode_dart package has wrong documentation

I am trying to use flutter youtube_explode_dart package but I am facing some errors mainly two
with video.property
Code:-
var video = yt.videos.get('https://youtube.com/watch?v=Dpp1sIL1m5Q');
var title = video.title; // Error in this line
with streamManifest
Code:-
// Error saying streamManifest is not defined
var streamInfo = streamManifest.muxed.withHigestVideoQuality();
Link to the documentation code :- https://pub.dev/packages/youtube_explode_dart
If anyone has used the package or knows the fix PLEASE HELP!
use
manifest=yt.videos.streamsClient.getManifest(url);
after getting manifest then
var streamInfo = manifest.muxed.withHigestVideoQuality();
then use this hopefully your error will be solved please let me know if solved

Metadata-Extractor -- Missing List of Tags?

I'm using metadata-extractor to retrieve metadata from video files. I have it successfully retrieving the directories. Now I need to query the directories for specific info -- duration, height, etc.
The metadata-extractor docs give this example of how to query for a specific tag value:
// obtain the Exif directory
ExifSubIFDDirectory directory
= metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
// query the tag's value
Date date
= directory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
So it appears I need to get a list of the relevant tags, such as TAG_DATETIME_ORIGINAL, for duration, height, etc.
This page in the metadata-extractor docs contains a link titled "the various tag values", but the page it goes to lists tags for still images only, not for video files.
Googling for Metadata-Extractor -- Complete List of All Tags does not seem to bring up a list of all tags.
Are the metadata-extractor docs really missing a list of tags, or am I approaching this the wrong way somehow?
I found a list of tags at:
https://developer.tizen.org/dev-guide/2.3.1/org.tizen.guides/html/native/multimedia/metadata_extractor_n.htm
However, those constants don't seem to be what's needed in actual code. Here's Java code that works:
import com.drew.imaging.ImageMetadataReader;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import com.drew.metadata.file.FileTypeDirectory;
import com.drew.metadata.mp4.Mp4Directory;
import com.drew.metadata.mp4.media.Mp4SoundDirectory;
import com.drew.metadata.mp4.media.Mp4VideoDirectory;
[.....]
Metadata theMetadata = null;
try {
InputStream stream = new URL(theVideoInfo.getLinkToVideo()).openStream();
theMetadata = ImageMetadataReader.readMetadata(stream);
}
} catch (java.lang.Exception exception) {
exception.printStackTrace();
}
Mp4SoundDirectory soundDirectory
= theMetadata.getFirstDirectoryOfType(Mp4SoundDirectory.class);
Mp4VideoDirectory videoDirectory
= theMetadata.getFirstDirectoryOfType(Mp4VideoDirectory.class);
Mp4Directory mp4Directory
= theMetadata.getFirstDirectoryOfType(Mp4Directory.class);
FileTypeDirectory fileTypeDirectory
= theMetadata.getFirstDirectoryOfType(FileTypeDirectory.class);
String numberOfAudioChannels
= soundDirectory.getString(Mp4SoundDirectory.TAG_NUMBER_OF_CHANNELS);
String duration = mp4Directory.getString(Mp4Directory.TAG_DURATION);
String frameRate = videoDirectory.getString(Mp4VideoDirectory.TAG_FRAME_RATE);
String height = videoDirectory.getString(Mp4VideoDirectory.TAG_HEIGHT);
String width = videoDirectory.getString(Mp4VideoDirectory.TAG_WIDTH);
String type = fileTypeDirectory.getString(FileTypeDirectory.TAG_DETECTED_FILE_MIME_TYPE);
I found the constants (TAG_HEIGHT, TAG_WIDTH, etc.) by directly examining the metadata-extractor objects in the debugger. For example, I'd type:
Mp4VideoDirectory.WIDTH
...and the debugger (IntelliJ) would auto-complete the available constants that had the text "WIDTH" in them.

Protobuf import failure

Does anyone know where I can find an example of a gRPC protobuf file that imports from a different file and uses a protobuf message in a return? I can't find any at all.
I have a file...
syntax = "proto3";
package a1;
import "a.proto";
service mainservice {
rpc DoSomething(...) returns (a.SomeResponse) {}
}
a.proto is also in the same directory and also compiles by itself. The error messages I'm getting are:
"a.SomeResponse" is not defined.
mainfile.proto: warning: Import a.proto but not used.
Found the answer... need to make sure the package name of a.proto is used when specifying the object imported (eg: a_package_name.SomeResponse). Example:
base.proto
syntax = "proto3";
option csharp_namespace = "Api.Protos";
package base;
message BaseResponse {
bool IsSuccess = 1;
string Message = 2;
}
user.proto
syntax = "proto3";
import "Protos/base.proto";
option csharp_namespace = "Api.Protos";
package user;
message UserCreateResponse {
base.BaseResponse response = 1;
}
Seems import from root but not current proto file's folder. So you need add 'Proto/a.proto' if all your proto files are under Proto folder.

import scalafx.Includes._ causes error when included to file

I recently installed the latest version of Scala IDE from the link provided on its website for Eclipse, and imported scalafx version 2.22 jar and then installed SBT (the latest version). Then I was trying out the following code from scalafx.org :
import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.scene.Scene
import scalafx.scene.paint.Color
import scalafx.scene.shape.Rectangle
object HelloStageDemo extends JFXApp {
stage = new JFXApp.PrimaryStage {
title.value = "Hello Stage"
width = 600
height = 450
scene = new Scene {
fill = Color.LightGreen
content = new Rectangle {
x = 25
y = 40
width = 100
height = 100
fill <== when (hover) choose Color.Green otherwise Color.Red
}
}
}
}
However, I wasn't able to run as I got built errors of the following :
error while loading AccessibleAction,invalid distance too far back
error while loading CycleMethod,invalid LOC header(bad signature)
error while loading JobSettings,invalid LOC header(bad signature)
HelloStageDemo's tests not built due to errors in dependent scope(s) main
The error can be rid by not importing the Includes object (import scalafx.Includes._ )
I tried to google search the problem, but I couldn't find any explanation about it.. And so I tried this code on another machine without SBT installed, and it works there even when including the import.scalafx.Includes._ line..
Both of the machines uses JVM version 8..
So is this problem related to my SBT installed on my machine, or is it other type of problem? Also what do the errors mean?
Thanks in advance

scala : getwords similar to getlines

I want to write a piece of code that looks like following :
var wordItr = Source.fromFile("myfile").getWords
while (wordItr.hasNext) {
val word = wordItr.next
process(word)
}
Reason behind this logic is "myfile" file is really big (around 10GB) and has no line breaks and writing a code like above really helps.
Can you please suggest how to code wordItr
Source.fromFile("myfile").getLines.flatMap(_.split(" "))
or
import java.io.File
import java.util.Scanner
var wordItr = new Scanner(new File("myFile")).useDelimiter(" ")