This could be a unusual question. I have a problem with navigating in gradle groovy api doc. For example see following code,
uploadArchives {
repositories {
ivy {
credentials {
username "username"
password "pw"
}
url "http://repo.mycompany.com"
}
}
}
In above code how can i find what goes into "credentials" closure in api documentaion ?
Thanks
I'm quite new to Gradle myself, but this is what I would do:
Start from Project as the build script is always executed against a Project instance
Look for repositories { }
It mentions RepositoryHandler, so look for ivy { } there
ivy() returns a IvyArtifactRepository, so I guess the closure will be executed against that
However there is no credentials { } defined on IvyArtifactRepository
Jump to its API doc to check its superclasses (link on the top of the page)
You can see there that credentials is defined on AuthenticationSupported
PasswordCredentials is mentioned there, and finally you see that it only has username and password properties
It's not always very intuitive, and I miss code completion a lot, but once you get the hang of it, it becomes easier to find your way through the documentation.
Related
Based on an critical API change by android API Level 31 (refer to this thread click here) we need to fix some lines in libtelemetry/libcore of the following repository:
https://github.com/mapbox/mapbox-events-android.
Therefore we want to compile the project by ourself as the repo does not seem to be maintained at all.
We downloaded the whole project and trying to compile in Android Studio. But we can't get rid of this error:
Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/gradle/plugins/sdk-registry/0.4.0/sdk-registry-0.4.0.pom'.
Received status code 401 from server: Unauthorized
What we have already tried:
Added a new private download token in our mapbox-account
Added the following lines to the settings.xml based on this documentation (navigation-sdk for android docs)
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = "OUR_PRIVATE_TOKEN"
}
}
}
}
any ideas what we are missing to compile the project correctly? oO
thanks in advance!
Struggling to find a working example or a document that explains how to set contentful app installation params. I can see how to get them from the SDK but settings them i cant.
any help is much appreciated.
Most likely your app has a Config Location which means you are building UI that will be shown to the user during and after installation of your app. In this location, there is an SDK method called sdk.app.onConfigure. This method takes a function which will return an object which is called targetState.
targetState documentation can be found here.
Let's take a React Config app as an example where we will set {foo: 'bar'} as our installation parameters:
export default class Config extends Component<ConfigProps, ConfigState> {
constructor(props: ConfigProps) {
super(props);
// letting the SDK know we have a configuration function which will
// return `targetState`
props.sdk.app.onConfigure(() => this.onConfigure());
}
// This method will be called when a user clicks on "Install"
// or "Save" on the configuration screen.
onConfigure = async () => {
// the object returned here is what Contentful calls `targetState`.
// it is simply a configuration object set when the app is installed or updated
return {
parameters: { installation: { foo: 'bar' } }
};
};
In the example above, when a user hits "Install" or "Save" on the app's Config location, the installation parameter object of {foo: 'bar'} will be saved and can then be accessed in other app locations via the SDK.
On the off chance you are purely using the API to create or modify an AppInstallation, you can use the Content Management API to update the app's parameters as described in the documentation here.
Late answer but i also struggled with it. I found a tutorial here:
https://dev.to/wiommi/how-i-built-a-contentful-app-combined-with-commerce-js-iii-33fo
They are added manually in ConfigScreen.tsx
You need to add them to your interface
export interface AppInstallationParameters {}
fx:
export interface AppInstallationParameters {
apiKey?: string;
projectId?: string;
}
And then set them manually with fx.
setParameters({ ...parameters, [PARAMETERNAME]: [PARAMETERVALUE] });
I am trying to configure an extension using the method described at Manifest for storage areas
. I'm pretty sure I have everything set up correctly, but I am not seeing the policy value in chrome://policy(it is shown as Not set) and, obviously, there is no policy seen from
chrome.storage.managed.get(null,(d)=>{console.log(d)});
I've checked my schema and the config file I uploaded in the Admin Panel at https://www.jsonschemavalidator.net and it seems to match. It's very simple, schema.json is
{
"type" : "object",
"properties" : {
"PolicyTest" : {
"type" : "string"
}
}
}
and in the json file
{
"PolicyTest" : "test"
}
Before I spend a bunch of time debugging this, I thought I would quickly ask- could this be because the extension that I am configuring this for is not hosted on the Chrome Web Store? It's hosted myself using the method described at Autoupdating.
Other than that, I'm not really sure why this isn't working- the device running Chrome is Linux, although I have also checked on a managed Chromebook, and I've checked things like making sure I've selected the right OU, refreshing the policy, and so on.
Ok, I figured it out by reference to the Chromium documentation. To answer the question in my title- yes, it works fine for extensions not hosted on the Web Store, I just had the wrong format for my options.
Basically, my json file didn't actually match the schema. For the schema I posted in my question, you actually need this :
{
"PolicyTest" : {
"Value" : "test"
}
}
Basically, your properties need to be an object with a Value field. The core sentence that I missed is : The txt file should contain a valid JSON object, mapping a policy name to an object describing the policy.
Mea cupla, I should have read the documentation more carefully. It's quite frustrating that the official Chrome extension developer documentation doesn't have a simple example of a schema and a matching config file, since there is no UI feedback if your format is wrong.
I note also there was some plan to publish a tool to build a template from a schema. I guess that never happened, it would be useful too.
I crated area/modular MVC5 application according to this tutorial:
This
it worked perfectly on local. but i got 404 error, when i deployed project on iis and clicked on specified area link.
and i didn't find any solution for that.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Sale
and this is my action links which are perfectly working on local run:
#Html.ActionLink("Sale","Index","Sale",new { Area="Sale"},null)
edited:
public class SaleAreaRegistration:AreaRegistration
{
public override string AreaName
{
get
{
return "Sale";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Sale_default",
"Sale/{controller}/{action}/{id}",
new { controller = "Sale", action = "Index", id = UrlParameter.Optional },
new string[] { "MVCPluggableDemo.Controllers" }
);
}
}
attention: according to the tutorial which i said in first line. i created my module project in another virtual project in solution(the real path is in area folder of main project like"~/ProjectName/Areas/"). but i think the publisher does't understand it...because i don't see any of my module views in deployed path.
its better to completing my help request by this obvious question:
How to deploy MVC project include areas, and the modules which are in areas folder?
Its simply obvious:
Check your page directory. The server cannot locate your the file,
it maybe in different folder.
Also try to Check this.
the main Reason of my problem was this:
VisualStudio doesn't include my Area folder, in publish path..why? i don't know
Solution: no solution yet!..but i added my module dll inside bin folder manually. and created my areas folder and his modules projects solution(dlls' are not not necessary) in main published solution, manually to ..
finally it worked, but i dont thing is the standard solution
I am trying to work out how to use the Hooks and just can't seem to get the syntax correct.
I have built a site using PirahnaCMS that has a blog component and am extending it to call some social plugins and auto post to FB, Twitter etc.
I just can't seem to get the syntax correct though. My app is MVC and I have looked at this section
1.2 ASP.NET MVC
If you're using ASP.NET MVC hooks should be attached in you Global.asax.cs in the Application_Start method, or any other place where you keep you startup code. You attach you hooks with the followin syntax:
protected void Application_Start() {
Piranha.WebPages.Hooks.Menu.RenderItemLink = (ui, str, title, url) => {
str.Append(String.Format("<span>{1}</span>", url, title)) ;
} ;
}
The Hook I believe I want to use is Piranha.WebPages.Hooks.Manager.PostEditModelAfterSave but for the life of me I can't seem to work it out.
All of the hooks are just static delegates that you can attach methods to. In the above example an anonymous method has been assigned to the hook with the syntax:
delegate += (parameters) => { method body }
You could also assign a previously declared method.
delegate += MyMethod
Example skeletons for attaching hooks should be available in the Docs at the official site. If not you can find the hooks in the file:
~/WebPages/Hooks.cs
And all delegates in:
~/Delegates.cs
I hope these URL:s are correct as I'm typing from memory :)
Regards