I created a new Package with Xcode and incorporated a dependency, however when I try to use it, I get an error.
How do I use the dependency in the Package sources? In a normal project, I can easily import and use AgileDB.
Here's the Package:
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "DBCore",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "DBCore",
targets: ["DBCore"]),
],
dependencies: [
.package(url: "https://github.com/AaronBratcher/AgileDB", from: "6.4.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "DBCore",
dependencies: []),
.testTarget(
name: "DBCoreTests",
dependencies: ["DBCore"]),
]
)
Perhaps the AgileDB package as a dependency in the target? I tried copying that and it won't recognize it.
Found my answer.
In the target dependencies, need to include the package name as a string:
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "DBCore",
dependencies: [
"AgileDB"
]),
.testTarget(
name: "DBCoreTests",
dependencies: ["DBCore"]),
]
Step by step guide:
Open project settings
Click on "Package Dependencies"
Click on the "Plus" icon and add your package in the window that opens
Your added package should appear in the list
Package should also appear under "Package Dependencies" in the left bar
Click on your target
Navigate to "General" tab and "Frameworks and Libraries" section under that
Click on "Plus" icon and select/add your package in the window that opens
Your added package should appear in the list
Package should automatically be added in "Build Phases" tab under "Link Binary with Libraries" section. If it isn’t add it by clicking the "Plus" icon
At this point you should be able to import and use the package in any of the files under this target.
Related
I am writing a function or a commandlet (I want to call it Set-Metadata) that will allow me to attach metadata information to directories and files. Its for a file manager columns that expect ADS data
I am currently stuck on the logic part.
Before I write any metadata to a file via its NTFS ADS I would first like to check if the file has a specific stream so that I don't overwrite anything and instead append text to the stream.
function Set-MetaData(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]
$Path,
[Alias("C", "Cat")] #Replace Column Content
[String]$Category,
[Alias("PC", "PCat")] #Prefix to the content in Column
[String]$PCategory,
[Alias("SC", "SCat")] #Suffix to the content in Column
[String]$SCategory){
process {
Switch ($PSBoundParameters.Keys){
'Category'{
}'PCategory'{
}'SCategory'{
if(...) #file has a stream called "multitags.txt"
# Add-Content -Path $Path -Stream multitags.txt -Value $Category
}}
}
I have taken the liberty to cross post this question on other forums as well.
Any help would be greatly appreciated!
I want to execute the Spark program from Workflow and store the results on Minio. What do I do?
Here is an example Pi that I executed using workflow choreography
apiVersion: argoproj.io/v1alpha1
kind: Workflow
...
manifest: |
apiVersion: "sparkoperator.k8s.io/v1beta2"
kind: SparkApplication
metadata:
name: spark-pi
namespace: spark
spec:
type: Scala
mode: cluster
image: "gcr.io/spark-operator/spark:v3.1.1"
nodeSelector:
kubernetes.io/hostname: node01
imagePullPolicy: Never
mainClass: org.apache.spark.examples.SparkPi
mainApplicationFile: "local:///opt/spark/examples/jars/spark-examples_2.12-3.1.1.jar"
...
driver:
...
executor:
...
- name: sparkling-operator
dag:
tasks:
- name: SparkGroupBY
template: spark-groupby
I am unable to update content in xml tag using xml Twig module.
Here is my xml file :-
<?xml version="1.0"?>
<test customerProprietary="false">
<classes>
<class name="new" />
</classes>
<chars>
<log>false</log>
</chars>
</test>
Code snippet:-
my $twig = XML::Twig->new(
pretty_print => 'indented',
twig_handlers => {
log => sub {
if ($_->text eq 'true'){
exit;
}
else{
print $_->text;
subp4open($xmlfile);
$_->set_text( 'true' );
exit;
}
}
);
$twig->parsefile($script_path);
$twig->print_to_file($script_path);
i have to update <log>false</log> to <log>true</log>. Am i missing something here?
That's because exit exits the program, so print_to_file is never reached. Remove the exits. You can replace them with returns, but they aren't needed.
When I run into these sorts of things, I like to put a statement like say "This far" to see that I've made it to a particular part of the code:
say "About to parse file";
$twig->parsefile($script_path);
say "About to print file";
$twig->print_to_file($script_path);
In your handler, there are some things that you can improve. Since you don't want to do anything in the case that the value is already true, don't even think about that case:
log => sub {
if ($_->text ne 'true'){
print $_->text;
subp4open($xmlfile);
$_->set_text( 'true' );
}
},
I might be inclined to always update the value if you want them all to be true. I don't care what it was before as long as I get what I want at the end (although this way tweak your source control a bit):
log => sub { $_->set_text( 'true' ) },
Also, I might consider doing any Perforce magic outside of the twig handler. Get the lock on the file before you give it to Twig. If you can't get that lock, you might as well not process it. Then, remember to release it later. If you do all of those operations close together, you're less likely to forget a step.
According to this scenario.
Used to test it using sample message - text. And it works fine.
I should implement that by using buttons (callbacks).
The real problem is :
Sample text :
context.Activity.Id
"mid.$cAAOmNGtaSJ9i1_f223cprKylFOpb"
on button click (callback) :
context.Activity.Id
"9Yw5TAcq1qr"
This is the code i used to post human support button :
msg.AttachmentLayout = AttachmentLayoutTypes.Carousel;
msg.Attachments = new List<Attachment>();
ThumbnailCard thumbnailCard2 = new ThumbnailCard()
{
Buttons = new List<CardAction>
{
new CardAction ()
{
Value = "Method_Support",
Type = "postBack",
Title = "Human Support"
},
},
};
msg.Attachments.Add(thumbnailCard2.ToAttachment());
await context.PostAsync(msg);
It returns activity.Id : 9Yw5TAcq1qr - as i already mentioned. I can't use that id to query Facebook graph api.
What's the best way to handle scenario like this ?
Is it possible to render all incoming messages as native Facebook (sample-text) messages ?
Is it possible to make call to graph api using callback's activity.id ?
Following my previous answer about how to link the Activity from botFramework to the messages in Conversation in Facebook's Graph API, I had a look to your problem.
Analysis
From my point of view, there is a strange thing in this Activity.Id value because on Facebook's side, all messages have the same id format, even for callbacks.
Here is a capture of 2 messages (1st one is the latest one) from Facebook Graph API:
{
"data": [{
"messages": {
"data": [
{
"id": "m_mid.$cAAC3Jml0RcBi2JK3Clcp01uu8FFe",
"message": "Human support"
},
{
"id": "m_mid.$cAAC3Jml0RcBi2I5bXlcp0kScM7af",
"message": ""
}
]
},
"id": "t_mid.$..."
}]
}
Message with empty text is a ThumbnailCard with a CardAction inside (type = postback, Value = Method_HumanSupport)
Human support is what is sent on the click on the CardAction
What is surprising is that on the bot side, for those 2 messages we have the following values for Activity.Id:
For "id": "m_mid.$cAAC3Jml0RcBi2I5bXlcp0kScM7af" (my Thumbnail) => mid.$cAAC3Jml0RcBi2I5bXlcp0kScM7af, so it's matching
For "id": "m_mid.$cAAC3Jml0RcBi2JK3Clcp01uu8FFe" (the callback) => DWhE2C0VO79, no match at all
For information my ThumbnailCard is made like the OP said:
var msg = context.MakeMessage();
msg.AttachmentLayout = AttachmentLayoutTypes.Carousel;
msg.Attachments = new List<Attachment>();
msg.Text = "updates & support";
ThumbnailCard thumbnailCard2 = new ThumbnailCard()
{
Buttons = new List<CardAction>
{
new CardAction ()
{
Value = "Method_HumanSupport",
Type = "postBack",
Title = "Human support"
}
}
};
I will add a question on Bot Framework GitHub Project.
Edit: issue logged: https://github.com/Microsoft/BotBuilder/issues/2950
Workaround
There are several workaround that will depend on your global use cases: you could try to log the Activity.Id of a "normal" message in the discussion and use this value later when your callback is clicked, or you can also try to change your flow to avoid making this kind of link between Bot Framework and Facebook Graph API.
I am new to iOS development. I am working on an ePUB reader app for iPad.
The server sends me file with .acsm extension. Its an XML formatted file. Now I need to parse this acsm file and download the book.
The server side developer says that its working and he's able to download the ebook using Adobe Digital Editions.
What should I do to download the actual book and display it?
These are the contents of acsm file:
<fulfillmentToken fulfillmentType="buy" auth="user" xmlns="http://ns.adobe.com/adept">
<distributor>urn:uuid:861ac232-6f99-4be5-8b78-28d3aa1a1200</distributor>
<operatorURL>http://litstage.cloudapp.net:8080/fulfillment/</operatorURL>
<transaction>ACS4-6490845051477798803551940</transaction>
<expiration>2012-12-05T10:57:33+00:00</expiration>
<resourceItemInfo>
<resource>urn:uuid:45c004e9-ff9f-4117-94b9-c6776176fa62</resource>
<resourceItem>0</resourceItem>
<metadata>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">The Divine Comedy</dc:title>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dante, Alighieri</dc:creator>
<dc:publisher xmlns:dc="http://purl.org/dc/elements/1.1/">FeedBooks (www.feedbooks.com)</dc:publisher>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/">urn:uuid:7d0300ba-2381-11dd-8c0f-001cc049a027</dc:identifier>
<dc:format xmlns:dc="http://purl.org/dc/elements/1.1/">application/epub+zip</dc:format>
<dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">en</dc:language>
<thumbnailURL>http://litstage.cloudapp.net:8080/media/45c004e9-ff9f-4117-94b9-c6776176fa62.jpg</thumbnailURL>
</metadata>
<licenseToken>
<resource>urn:uuid:45c004e9-ff9f-4117-94b9-c6776176fa62</resource>
<permissions>
<display/>
<excerpt/>
<print/>
<play/>
</permissions>
</licenseToken>
</resourceItemInfo>
<hmac>gGIGmkDLFpWda2dWchW3E46O9oA=</hmac>
</fulfillmentToken>