The best way to share telescope post on Facebook - facebook-graph-api

I play with telescope (meteor open source project) and I want to share the post link instead of source link on Facebook; so I did,in the telescope-module-share package, something like this:
sourceLink: function(){
return window.location.origin + "/posts/"+this._id;
},
It works great, except when I share the post on Facebook, it display the title and description of home page instead of the post shared!!
Anyone have an idea to fix it, please!!!

Consider using Server Side Rendering, there's a great package for this : https://github.com/meteorhacks/meteor-ssr

Related

ember-cordova cannot multi-upload photos with x-file-input

I am using the plugin from https://github.com/thefrontside/emberx-file-input. I want to multi-select photos while uploading. I can do it from the laptop. But when I use ember-cordova and create app on my android device, I cannot multi-select photos even though I have added the multiple = true in the code. Here is the code below,
{{#x-file-input multiple=true action=(action "selectImg")}}
Do you use a block or inline component invocation? You use # at the start of component name, it means you have to close it by {{/x-file-input}}, I just try to understand if it just a typo..
I see emberx-file-input addon is out of date since the last activity in Github is Dec 2017. I suggest you to use ember-file-upload addon.
If you are implementing the file upload module only buy now i would suggest you to go with ember-file-upload addon.

Posting to Page Via Facebook API - Mentioning (linking) friends and Pages

I'm using the facebook open graph api to post to a facebook fan page. More info on the method can be found in the answer here.
When one manually posts on facebook they can use # to link a particular person e.g. #Michael Jackson. This auto populates a link to that persons page and shows up on their timeline. The # itself dissapears once the post has been made, leaving only the hyperlinked text i.e. Michael Jackson.
Programatically compiling a post via the api, including the #, results in the text being posted in plain text. i.e. #Michael Jackson shows as #Michael Jackson.
How can I escape, or otherwise parse the anchor through the api so that Facebook recognises it as a link to another user/page?
Edit: I found this reference which describes these links as Actions, specifically in this case a 'Mentioning friends' action. It goes on to explain the syntax of #[USERID] or #[USERNAME] which is promising. But if I compile this encoded it posts the plain encoded text e.g. %40%5BUSERID%5D, when left un-encoded the post fails.
I've found that starting your message with a mention tag (i.e. #[12345678:User Name] ) throws a CurlException error.
To fix this I changed:
'message' => '#[1234567890:User Name]';
To
'message' => ' #[1234567890:User Name]';
Simply adding a space before the mention seems to fix that problem.

Problems with the Intro app video for ember.js?

I am watching the Bulding an app with ember.js (the intro 30 minute video) and I am having an issue with the date function with moment.
Ember.Handlebars.registerBoundHelper('date', function(date) {
return moment(date).fromNow();
});
I entered that code and everything is ok when I refresh the page. However when I go back to the index.html and change the code:
<h2>by {{author}} <small class="muted">({{ publishedAt}})</small></h2>
now when I add the date from the app.js to index.html
<h2>by {{author}} <small class="muted">({{date publishedAt}})</small></h2>
after I enter the date and reload my page I just get a blank page? What am I doing wrong?
I guess you are running into a js file loading order issue and thus the error ReferenceError moment is not defined.
I've setup the bloggr client app in a jsbin here and the moment lib works correctly as far I can see. Have a look at the jsbin, maybe you find the difference to your code.
Hope it helps

Not visualizing ASCII STL file correctly

My problem seems similar to Not able to visualize a loaded data , but I have no console errors and I have already added the '-allow-file-access-from-files' flag to my Chrome Browser. Here's my Java coding,
window.onload = function() {
var r = new X.renderer3D();
r.init();
pros = new X.mesh();
pros.file = 'file:///C:/Users/Nathan/Downloads/JB Farmer STL ACII.stl';
pros.caption = 'Prosthetic';
r.add(pros);
r.render();
};
Should I "play around" with with camera position, I know I have to do that in Three.js.
Maybe the model needs normals? I'm not sure if it does or not. I haven't worked with 3D modeling, besides Three.js.
Update: Ummmm, I'm not sure what is going on with this, but I realized that XTK generated 2 canvases . I looked at the first two Lessons and they have one.
^ Now eliminated the extra canvas, must have copied a piece and that was in there.
For the moment, the loader of xtk doesn't seem to be done for local. I mean : it uses an XMLHttpRequest (XHR) to get the file with a GET request. First of all the request must be sent to something that can handle it (a server or localhost emilated by Wamp or equivalent). Then let's imagine if one broswer, no matter what one, allows XHR on a file at client side by his url, and imagine I'm a pirate and you come on my website. I know Windows well, I know in C:/Windows/System32 there always is a file where I can find your personals data. What do I do ? An XHR ! You've been hacked. It's a story but you see the idea.
That's why the only ways allowed by browsers to access local files are HTML5 File API & HTML5 Drag&Drop API (unfortunately...). Actualy a way to go through that limitation is having binary code at the client side (flash, java applet). The client is the only one who can ask to open a file or drop a file, so the browser is sure there won't be any security failure because of him.
So you should test it with something like Wamp and access your file with an url like "http://localhost/.../myfile.stl" or the relative url "/.../myfile.stl", or do the following if you realy want local files.
A few weeks ago I wrote my own parser for a private format for xtk and from local file, it worked well, I just used HTML5 APIs to read the file and get a String or BinaryArray from it and then wrote a parser that transformed it in a X.mesh. So I think the best would be to extend the X.loader for HTML5 file APIs, or like me to manualy load the file.
The following jsFiddle from Haehn helps : here !
What happens if you modify the filename with no space?
JB Farmer_STL_ACII.stl instead of JB Farmer STL ACII.stl

Sitecore (sitecore social connector) - unable to customize content posted to facebook/twitter

I've recently installed the sitecore social connector module, and I've placed tweet and like buttons on a page, but I can't seem to control the content either sends to twitter/facebook. The tweet button sends the title of the page as the text to be tweeted, and I'd like to override this.
The facebook like link doesn't seem to do anything. If I go back to the same page, it still shows 1 like, but nothing has appeared on my facebook page.
Any help would be greatly appreciated.
I've decompiled the CodeBehind for the Tweet sublayout and it has this for code:
protected void Page_Load(object sender, EventArgs e)
{
string text = "var xmlhttp;if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");}xmlhttp.open(\"GET\",url,true);xmlhttp.send();";
string script = string.Format("<script>twttr.events.bind('tweet', function (event) {{var url = '{2}?itemid={1}&eventname={3}&buttontype=tweet';{4}}});</script>", new object[]
{
Sitecore.Context.User.Name.Replace('\\', '.'),
Sitecore.Context.Item.ID.ToString(),
"/layouts/system/Social/SocialEvents.aspx",
base.EventName,
text
});
this.Page.RegisterStartupScript("tweetsubscribe", script);
}
If you want to change it, you need to de-compile Sitecore.Social.dll which is in the package. Un-zip the package and open the files folder and the DLL will be in the /bin/.
If you don't have a decompiler, ILSpy is a great free one. You can do the same for the other feature, just de-compile and re-build in a local project with changes.
Update: just to clarify, you need to de-compile the current C# in the DLL to make changes to it. You can re-compile into a separate project, you just need to change the Inherits="" in the front-end of the control, e.g.
Instead of this:
Inherits="Sitecore.Social.Sharing.Controls.TweetButton"
Do something like this:
Inherits="MyProject.Sharing.Controls.TweetButton"
Apologies for the very late reply. I did not realise someone had asked me for a reply.
In the end I found it easier to just use the standard Twitter/Facebook controls. I have since learned that while Sitecore has some useful modules for handling CMS operations, it is often easier on the Content Delivery side to just use whatever web technology is the easiest to implement.
https://dev.twitter.com/web/tweet-button
https://developers.facebook.com/docs/plugins/share-button?locale=en_GB