Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to Post the below infromation to FaceBook from Myapp using FaceBook ShareLinkContent class
- link url (using SetContentUrl method)
- image (using setImageurl method)
- hashtags (using setHashTag method)
- and Description
as like
ShareHashtag shareHashTag = new ShareHashtag.Builder().setHashtag(hashtag_name).build();
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setImageUrl(Uri.parse(selectedImagePath))
.setShareHashtag(shareHashTag)
.setContentDescription(textd)
.setContentUrl(Uri.parse(linkUrlPath))
.build();
shareDialog.show(linkContent);
}
} else {
shareImage();
}
The question is, instead of posting the image from "selectedImagePath" url, it post the meta-data image coming from the "linkUrlPath" url.
How to overcome it, so that i can post the image which i send in the method setImageUrl() method.
note: I am using Facebook SDK 4.14.1
Kindly provide suggestions
I guess this is what you are looking for -
Template Matching
Template Matching is a method for searching and finding the location of a template image in a larger image. OpenCV comes with a function matchTemplate() for this purpose. It simply slides the template image over the input image (as in 2D convolution) and compares the template and patch of input image under the template image.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How do I save the current URL of android studio web view when the app is closed and load that URL when next the app is open.
You could do it with shared preferences.
This is not the best way, but easy to use:
First get the url from your webview
String currentUrl = webView.getUrl();
Then save it with shared preferences:
SharedPreferences prefs = getSharedPreferences("YOUR_TAG", Context.MODE_PRIVATE);
prefs.edit().putString("URL_TAG", currentUrl ).apply();
Now the string is stored in shared preferences and you can get the value after an
app restart on this way:
SharedPreferences prefs = getSharedPreferences("YOUR_TAG", Context.MODE_PRIVATE);
String savedUrl = prefs.getString("URL_TAG", null);
And last set the url to your webview:
webview.loadUrl(savedUrl);
Be sure, the YOUR_TAG and URL_TAG has still the same string value on
saving and receiving. Otherwise the stored String value wont found
More information to shared preferences can you find
on this post or on the offical android documentation
I hope I could help!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have one question - how to write a cucumber hook that asserts the web URL.
Example -
Let's say I am testing - https://www.usatoday.com/tech/
My Given is as follows -
Given I am on the "/tech/" page
I would like a method to add the base url (www.usatoday.com) + "/tech" and assert whether it is currently on that page
(driver.getURL() ==www.usatoday/tech/)
otherwise navigate to that page if I am not there.
Any Java pros that can help me with this? Many thanks my friends.
#Given("^I am on the \"([^\"]*)\" page$")
public void i_am_on_the_page(String arg) throws throwable{
String newBaseURL = getBaseURL() + arg;
String currentURL = driver.getCurrentURL();
try{
Assert.assertEquals(newBaseURL, currentURL);
}
catch(Exception e){
driver.get(newBaseURL);
}
}
I am assuming that you have a function - getBaseURL() that will provide you the base url.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How can I send mail from sites other than gmail, hotmail, rediffmail. Without any API provided. Is there provision to make this happen in any of programming languages. I think the domain I'm going to use does not have any captcha checks.
I also would like to attach a folder within.
If you are asking about other domain names, like your own domain then you can use below method:
Add using System.Net.Mail;
then below in some event
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("mail.yoursite.com");
mail.From = new MailAddress("testing#yoursite.com");
mail.To.Add("youremail#address.com");
mail.Subject = "New Email";
mail.Body = "add text here from controls";
SmtpServer.Port = 25;
SmtpServer.Credentials = new System.Net.NetworkCredential("testing#yoursite.com", "passhere");
SmtpServer.EnableSsl = false;
SmtpServer.Send(mail);
MessageBox.Show("All Done");
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to write an extension for OpenOffice.
This extension would be written in java (compiled, I don't want people to see the code).
It should do actions when I start openOffice writer, when I click on a button and when I print.
I've already added the button but I can't find how to link it with the code of what it should do.
I've read the wiki and the DevGuide but I don't find it very clear.
Could you please help me to start understanding how to create an extension (where should I put my code, how to link it with the GUI etc...)?
As an example, follow instructions at https://wiki.openoffice.org/wiki/OpenOffice_NetBeans_Integration#Configuration. Install the Apache OpenOffice API Plugin by going to Tools -> Plugins.
Click on the link that says OpenOffice.org Add-On Project Type to get more instructions. If you haven't yet, download AOO 4.1.2 and the AOO 4.1.2 SDK. (The plugin did not work for me using LibreOffice, but the resulting extension did work in LibreOffice).
After the code is generated according to the instructions, then add this code to the dispatch method of TestAddOn.java:
if ( aURL.Path.compareTo("HelloWorld") == 0 )
{
// add your own code here
com.sun.star.frame.XController xController = m_xFrame.getController();
if (xController != null) {
XModel xModel = (com.sun.star.frame.XModel) xController.getModel();
XTextDocument xTextDocument = (com.sun.star.text.XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class, xModel);
XText xText = xTextDocument.getText();
XTextRange xTextRange = xText.getEnd();
xTextRange.setString( "Hello World (in Java)" );
return;
}
}
Now compile and deploy the extension. When the "Hello World" toolbar button is clicked, it should put "Hello World (in Java)" in the document.
The code was adapted from https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=72459.
In order to handle events like when the document is opened, I also tried calling a method of the extension from Basic code like this:
Sub CallJavaMacro
MSPF = createUnoService("com.sun.star.script.provider.MasterScriptProviderFactory")
scriptPro = MSPF.createScriptProvider("")
xScript = scriptPro.getScript("vnd.sun.star.script:" & _
"com.example.testaddon.TestAddOn.PutHello?" & _
"language=Java&location=user:uno_packages/TestAddOn.oxt")
Thing = xScript.Invoke()
End Sub
However the Basic routine said it could not find the method. Maybe I did not declare the method properly or something.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My application contains an upload option from which the user can upload files(any file).
I know that users have the ability to write code/scripts in excel worksheet.So how can i prevent that from happening as it can lead to security breach.
Or what check can i apply to know that the uploaded worksheet contains any function?
I assume from the Java tag that your appliction to which the sheet gets uploaded is a Java application.
Using Apache POI, you can use a POIFSReader (see this doc) to read the file on a lower level.
There is an example by RĂ©al Gagnon which shows how you can check the content by looking at the name.
I had to modify the listener (added another comparision)
class MacroListener implements POIFSReaderListener {
[...]
#Override
public void processPOIFSReaderEvent(POIFSReaderEvent event) {
System.out.println(" Event: Name " + event.getName() + ", path "
+ event.getPath());
if (event.getPath().toString().startsWith("\\Macros")
|| event.getPath().toString().startsWith("\\_VBA")
|| event.getPath().toString().contains("_VBA_")) {
this.macroDetected = true;
}
}
}
so that it worked for some test files. You might have to tune/extend the checks.