EzDevInfo.com

share interview questions

Top share frequently asked interview questions

How to access shared folder without giving username and password [closed]

I have shared one folder to "Everyone" on a machine 1 and trying to access the folder from another machine 2. It is asking for username and password of the machine 1. I am accessing the share folder from Run>//shared folder path.

I am using Windows 7 machines.

Is there any way that i can access the shared folder without giving any username and password.


Source: (StackOverflow)

Got origin_mismatch error in Google+ share api

I want to share some dynamic content on google+. For this I checked it https://developers.google.com/+/web/share/interactive#rendering_the_button_with_javascript

<head>
<script type="text/javascript">
  (function() {
   var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
   po.src = 'https://apis.google.com/js/client:plusone.js';
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
 })();
</script>
</head>
<body>
<button
  class="g-interactivepost"
  data-contenturl="http://www.pubandbar-network.co.uk/" 
  data-clientid="102180630313.apps.googleusercontent.com"
  data-cookiepolicy="single_host_origin">  Share 
</button>
</body>

But when executing I am getting this error

Error: origin_mismatch
Request Details

    scope=https://www.googleapis.com/auth/plus.login
    response_type=code token id_token gsession
    access_type=online
    redirect_uri=postmessage
    cookie_policy=single_host_origin
    proxy=oauth2relay554026710
    origin=http://www.pubandbar-network.co.uk
    state=1995523240|0.4607792083184853
    display=page
    client_id=102180630313.apps.googleusercontent.com
    authuser=0

Please suggest how to fix this


Source: (StackOverflow)

Advertisements

Google+ share url: what parameters does it use?

I want to make like on Stackoverflow. I do not whant +1 button (it takes some time for loading and all page loading are little slower). I've looked on source page and didn't found any info of it... How do they do it???

On facebook this is:

url  = 'http://www.facebook.com/sharer.php?s=100';
url += '&p[title]='     + encodeURIComponent(title);
url += '&p[summary]='   + encodeURIComponent(text);
url += '&p[url]='       + encodeURIComponent(my_url);
url += '&p[images][0]=' + encodeURIComponent(pic);

Something like this must be for google+ share to, but i didn't found any helpful information during my search.

I know I can use such url: https://plus.google.com/share?url=my_url, but it's not enough - I also need share title, text and image, but what url GET parameters to use for this purpose?

Thanks in advance!


Source: (StackOverflow)

iOS share image AND text to WhatsApp

I have googled, and get some solutions, it seems the only possible way is thru UIDocumentInteractionController. I have found the result that able to share text ONLY, also found result that share image ONLY.

But what I want is share BOTH.

I know this question may be duplicated, I just wanted to make it clear, here is the screenshot...

WhatsApp share image + text

(This is shared from Android)


Source: (StackOverflow)

Android 6: cannot share files anymore?

I am sharing an image, and this code works properly for devices before Android 6:

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
Uri uri = Uri.fromFile(new File(mFilename));
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
mContext.startActivity(Intent.createChooser(shareIntent, mChooserTitle));

However I get the toast error "can't attach empty files" when I try to share using Android 6.

I verified that the file exists and it's not zero-length.

Anyone has a solution for this?


Source: (StackOverflow)

How do I create a standard iOS Share button?

The iOS Human Interface Guidelines say:

Use the system-provided Share button. Users are familiar with the meaning and behavior of this button, so it’s a good idea to use it when possible. The main exception to this is if your app does not contain a toolbar or navigation bar[, as] the Share button can only be used in a toolbar or navigation bar.

OK, but how do I “use the system-provided Share button”? A search of the documentation turns up nothing useful.

I've gathered that I should use UIActivityViewController in my response to the button being tapped, but how would I create the standard Share button in the first place?


Source: (StackOverflow)

How do you include hashtags within Twitter share link text?

I'm writing a site with a custom tweet button that uses the www.twitter.com/share function, however the problem I am having is including hash '#' characters within the tweet text.

For example:

http://www.twitter.com/share?url=www.example.com&text=I+am+eating+#branstonpickel+right+now
The tweet text comes out as 'I am eating' and omits the hash and everything after.

I had a quick look on the Twitter forums and learnt the hash '#' character cannot be part of the share url.
On https://dev.twitter.com/discussions/512#comment-877 it was said that:

Hashes are special characters in the URL (they identify document fragments) so they, and anything following, does not get sent the server.

and

you need to URLEncode it, so use %23

When I tried the 2nd point in my test link:

www.twitter.com/share?url=www.example.com&text=I+am+eating+%23branstonpickel+right+now
The tweet text came out as 'I am eating %23branstonpickel right now' literally including %23 instead of converting it to a hash.

Sorry for the waffely question, but does anyone know what it is I'm doing wrong?
Any feedback would be greatly appreciated :)


Source: (StackOverflow)

Get URI of .mp3 file stored in res/raw folder in android

I have many .mp3 files stored in res/raw folder.

I am getting URI of .mp3 file using following code.

Uri.parse("android.resource:///com.my.android.sharesound/"+resId);

This returns : android.resource:///com.my.android.sharesound/2130968609

Now I am using this URI in creating Share Intent

    shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("android.resource://com.my.android.sharesound/"+resId));
    startActivity(Intent.createChooser(shareIntent,"Share Sound");

When i select any Mail application eg. Gmail or YahooMail from the Share Intent, the mp3 file attached successfully. But it shows that 2130968609(as an attachment)

i dont want resourceId(2130968609) to appear.

I want to display fileName.mp3

How can i do that? Am i missing something ?

OR

Is there any other way to attach .mp3 file stored in res/raw to mail via Share Intent.


Source: (StackOverflow)

Android share intent for facebook- share text AND link

I am trying to use the Android share intent to post something on facebook. It looks like this:

shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Free education for all! http://linkd.in/xU8mCc");
startActivity(shareIntent);

So my post has both - some text and a link. But when the message is posted on facebook, it only has the link, no message. I tried various extras but nothing works.

Anyone faced this issue and solved it? I have facebook app version 1.8.1

Edit: I tried removing the link, and the facebook app does not take my message (shows a blank message to be posted), but not the other way round. So looks like the app is totally ignoring any plain text messages. I am spooked! Is this a major bug in the fb app that text messages can not be posted at all (with share intent)?


Source: (StackOverflow)

iOS: How to share text and image on social networks?

Please, can you tell me if I'm doing mistakes?

NSString *sharedMsg=[NSString stringWithFormat:@"Hello world"];
UIImage* sharedImg=[UIImage imageNamed:@"image"];
NSArray* sharedObjects=[NSArray arrayWithObjects:sharedMsg, sharedImg, nil];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] 
              initWithActivityItems:sharedObjects applicationActivities:nil];
activityViewController.popoverPresentationController.sourceView = self.view;
[self presentViewController:activityViewController animated:YES completion:nil];

At runtime when I select the icon of Facebook the text is missing, the image is correctly displayed.
My xcode is 6.3.1, tested on iPad.


Source: (StackOverflow)

How to make custom linkedin share button

I need to be able to add sharing functionality to custom buttom. I'm not interested with their generator, as I cant change linkedin image there. I want to use my own image for linkedin share button.


Source: (StackOverflow)

Android - Share on Facebook, Twitter, Mail, ecc

i need to develop an app that has the share function. I have to share on Facebook, twitter, email and maybe other services. How can i do this? There a library on the net? For the iOS development there were ShareKit, but for Android?? Thanks :)


Source: (StackOverflow)

How to use "Share image using" sharing Intent to share images in android?

I have image galley app in that app I placed all the images into the drawable-hdpi folder. and i called images in my activity like this :

private Integer[] imageIDs = {
        R.drawable.wall1, R.drawable.wall2,
        R.drawable.wall3, R.drawable.wall4,
        R.drawable.wall5, R.drawable.wall6,
        R.drawable.wall7, R.drawable.wall8,
        R.drawable.wall9, R.drawable.wall10
};

So now i want know how do i share this images using sharing Intent i putted sharing code like this :

     Button shareButton = (Button) findViewById(R.id.share_button);
     shareButton.setOnClickListener(new View.OnClickListener() {
     public void onClick(View v) {

        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        Uri screenshotUri = Uri.parse(Images.Media.EXTERNAL_CONTENT_URI + "/" + imageIDs);

        sharingIntent.setType("image/jpeg");
        sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
        startActivity(Intent.createChooser(sharingIntent, "Share image using"));  

         }
    });

And i have sharing button also when i click on share button Sharing box is opening But when i cliked any service mostly its crashing or some services say : unable to open image So how i can fix this or is there any othere format code to share images ????

Edit :

I tried using the code below. But its not working.

Button shareButton = (Button) findViewById(R.id.share_button);
     shareButton.setOnClickListener(new View.OnClickListener() {
     public void onClick(View v) {

        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        Uri screenshotUri = Uri.parse("android.resource://com.android.test/*");
        try {
            InputStream stream = getContentResolver().openInputStream(screenshotUri);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        sharingIntent.setType("image/jpeg");
        sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
        startActivity(Intent.createChooser(sharingIntent, "Share image using"));  

         }
    });

If don't mind somebody plz correct my above code OR give me a proper example plz How do i Share my images from drawable-hdpi folder


Source: (StackOverflow)

Default Sharing in iOS 7

I have seen this format (Image shown below) of share option in most of the iOS applications that support iOS 7. Is there a default code/framework available to implement this share option as it is shown in the image below?


Source: (StackOverflow)

Using global variables between files in Python?

I'm bit confused about how the global variables work. I have a large project, with around 50 files, and I need to define global variables for all those files.

What I did was define them in my projects main.py file, as following:

# ../myproject/main.py

# Define global myList
global myList
myList = []

# Imports
import subfile

# Do something
subfile.stuff()
print(myList[0])

I'm trying to use myList in subfile.py, as following

# ../myproject/subfile.py

# Save "hey" into myList
def stuff():
    globals()["myList"].append("hey")

An other way I tried, but didn't work either

# ../myproject/main.py

# Import globfile    
import globfile

# Save myList into globfile
globfile.myList = []

# Import subfile
import subfile

# Do something
subfile.stuff()
print(globfile.myList[0])

And inside subfile.py I had this:

# ../myproject/subfile.py

# Import globfile
import globfile

# Save "hey" into myList
def stuff():
    globfile.myList.append("hey")

But again, it didn't work. How should I implement this? I understand that it cannot work like that, when the two files don't really know each other (well subfile doesn't know main), but I can't think of how to do it, without using io writing or pickle, which I don't want to do.


Source: (StackOverflow)