Blackberry publish in facebook - facebook

I'm developing an application for Blackberry and i need to know what is the best solution in order to post in the user's wall on Facebook.
Thanks
Edited: I need to post in user's wall

maybe you should check Facebook BlackBerry SDK:
http://sourceforge.net/projects/facebook-bb-sdk/

I don't know if this is the best, but you could simple invoke facebook sharelink in BrowserField
String FACEBOOK_SHARE_URL = "http://m.facebook.com/sharer.php";
String FACEBOOK_URL_PARAM = "u";
String FACEBOOK_TITLE_PARAM = "t";
String shareLink = "http://www.links.com/link123";
String title= "Title";
String url = FACEBOOK_SHARE_URL + "?" + FACEBOOK_URL_PARAM + "=" +
shareLink + "&" + FACEBOOK_TITLE_PARAM + "=" + appName;
BrowserField browser = new BrowserField();
add(browser);
browser.requestContent(url + ";deviceside=true");

Related

Select HtmlToPdf - Html page saved in development and not saved but shown in production

I've got a problem with saving and NOT displaying a page that I want converted to pdf. The code I use works fine from within Visual Studio but not from IIS. On the development machine it converts the HTML page, saves the pdf and then redirects. On a 'production' machine with IIS it shows the html page (FactuurPDF) but stops there.
What I want is the behaviour on the development machine.
This is my code:
// other stuff
HtmlToPdf converter = new HtmlToPdf();
var TxtUrl = "";
TxtUrl = "https://localhost:44368/Facturen/FactuurPDF" + "?id=" + id + "&fact=" + fact;
PdfDocument doc = converter.ConvertUrl(TxtUrl);
var dat = DateTime.Today.ToString("yyyy-MM-dd");
doc.Save(#Path.Combine(_env.WebRootPath, "Verzondenfacturen/Fact_" + id + "_" + dat + ".pdf"));
doc.Close();
//other stuff (email pdf and update database)
return LocalRedirect("/Facturen/Index");
I hope anybody has a clue.
Setting the converter.Options.MaxPageLoadTime = 10 solved the problem.

Properly attaching pictures to an email with google scripts

I'm trying to make a script with google forms and sheets to help with the automation and tracking our technicians pictures on the jobsite.
The setup is they take pictures of the jobsite and fill out a google form with the information and attach the pictures there. When the form gets submitted, it runs this script to send an email to a predetermined email that everyone in the office can see.
So far I am able to get the email to send the information from the form besides the pictures.
The information for the attached pictures come in as a drive url that is all dumped into one cell as a string.
"https://drive.google.com/open?id=xxxxxxxx, https://drive.google.com/open?id=yyyyyyyy, https://drive.google.com/open?id=zzzzzzzz"
I convert this string to an array using .split(" ,) which outputs this.
[https://drive.google.com/open?id=xxxxxxxx, https://drive.google.com/open?id=yyyyyyyy, https://drive.google.com/open?id=zzzzzzzz]
I then iterate through the array and use.slice(33) to get rid of the url so all that I'm left with is the drive id (there is probably a better way of doing this but it works for now).
[xxxxxxxx, yyyyyyyy, zzzzzzzz]
This is the part where I'm having trouble.
I then iterate agian through that array and grab the driveID and the get the file as a JPEG.
I then use .push to put it into another array that I'm using to attachment them to the email.
The issue is that I think I'm not doing this step properly by not pushing the correct thing into the array and/or assuming that MailApp.sendEmail can even take an array for attachments.
I'm also not entirely sure how [Blobs] work and how to use them properly and that's probably where I'm getting stuck.
Again, this is code is made with very little experience and could probably be optimized futher but at the moment, I just need to have it attach the pictures properly to show that it works.
function onFormSubmit(e) {
//for testing purposes
var values = e.namedValues;
//gets the form's values
var pureValues = e.values;
//sets the values
var email = pureValues[1];
var woNum = pureValues[2];
var firstN = pureValues[3];
var lastN = pureValues[4];
var desc = pureValues[5];
var superDuperRawPics = pureValues[6];
//splits the picture urls into an array
var superRawPics = superDuperRawPics.split(", ");
//slices the url part off to get the drive ID
var i, rawPics =[]
for (i = 0; i < superRawPics.length; ++i) {
rawPics.push(superRawPics[i].slice(33))
}
//takes the array of ID's and gets the drive file
var j, picAttach =[]
for (j = 0; j < rawPics.length; ++j) {
var driveID = DriveApp.getFileById(rawPics[j]);
var drivePic = driveID.getAs(MimeType.JPEG);
picAttach.push(drivePic);
}
//sets the subject of the email to be Jobsite Pictures and the work number
var subject = "Jobsite Pictures" + " " + woNum;
//sets the body of the email
var body = "Technician: " + email + " \n" +
"WO#: " + woNum + " \n" +
"Customer: " + firstN + " " + lastN + " \n" +
"Description: " + desc;
//for checking if the vars are set correctly
Logger.log(superDuperRawPics);
Logger.log(superRawPics);
Logger.log(rawPics);
Logger.log(picAttach);
Logger.log(subject);
Logger.log(body);
//sends email to me with the new info
MailApp.sendEmail('example#domian.com', subject, body, {attachments: [picAttach]});
}
If you just want to attach them then use options attachments
I was being dumb and added brackets to the attachments: when it didn't need them.
The correct way is this.
MailApp.sendEmail('example#domian.com', subject, body, {attachments: picAttach});
Changing this has the script sending emails with the pictures attached.

BrowserWindow.Launch NOT decode string

In a codedui, this line decodes the link before opening the browser:
myBrowser = BrowserWindow.Launch(New System.Uri("http://blablabla/main.aspx?sn=JFA%3d%3d"))
I want it to remain encoded in the url. In other words, when the browser opens, the %3d are already converted to "=" in the string.
http://mylinkhere/main.aspx?sn=JFA==
I want them to remain as %3d.
Thanks
Try this bro, this is in c# btw.
String URL = HttpUtility.UrlEncode("sn=JFA%3d%3d");
window = BrowserWindow.Launch(new Uri("http://blablabla/main.aspx?" + URL));

Method post: accents on my app's description, posting on user's wall, result in diamonds and interrogation signs

I'm using a http call to post information about my app in any user's wall. I do it in this way:
_url = "https://graph.facebook.com/" + user_id + "/feed?message=MSG";
_url += "&access_token=" + access_token;
_url += "&picture=" + fb_app_url + "fb_icon.png";
_url += "&name=" + String_ToUrl("MY GAMES");
_url += "&link=" + "http://www.nlkgames.com";
_url += "&description=String_ToUrl("descripción with accent")"
_url += "&method=post";
http.URL_CALL(_url);
This method post right the information in the user's wall, but the accents are shown by a diamond with a question sign inside it. I don't know how to make it works with accents.
String_ToUrl will encode string in this way:
"descripción with accent" = "descripci%E9n+with+accent"
What's my fail? Why the user's facebook's wall doesn't recognize the urlencoded?
Instead of encoding it for URL, what happens if you just post the description as is?
If that doesn't work, try converting the string using HTML entities and then URL Encoding the description.
you could also try to replace those letters with the ASCII representation (somewhat like \u123) - that would be what the Graph API gives you when there is such a Special character (in my case it would be äöü from the german alphabet)
Your String_ToUrl function doesn't encode URL in unicode aware way.
ó (aka 'LATIN SMALL LETTER O WITH ACUTE' (U+00F3)) should became %C3%B3 in URL encoded form, and not %F3 (in your case you indicated that it became %E9 which in fact é character).
descripción -> descripci%C3%B3n
Be sure to use proper (and unicode aware) way to encode your parameters, in JavaScript for example encodeURIComponent should be used...

Push Notification showing localization constant instead of message

I have a serious problem I have not found any questions about on the net. When I push a localized message it only works for Swedish and not English. I have another that says that it only shows a constant for their Swedish Iphone 4. I have also tested on Iphone 3g and it has the same problem as my iphone 4, works in swedish not in english.
When displaying a popup for Iphone 4 in English, I only get the localization key I supply in my notification from the server.
Here is the string of the notification in C# that I push from a Windows Server. The extra parameters for my iphone app works totally fine in any language so it seems it has nothing to do with the server side part of the push.
int total = notification.AmountScheduledEvent + notification.AmountCourseResult + notification.AmountExam;
string locKey = (total > 1 ? "PushMessageMultiple" : "PushMessageSingle");
string msg = "{\"aps\":{"+
"\"alert\": {"+
"\"loc-key\":\"" + locKey + "\","+
"\"loc-args\":[\"" + total + "\"]},"+
"\"badge\":" + total + ","+
"\"sound\":\"default\"},"+
"\"amountSchedule\":" + notification.AmountScheduledEvent + ","+
"\"amountCourseResult\":" + notification.AmountCourseResult + ","+
"\"amountExam\":" + notification.AmountExam + "}";
In my Localizable.strings in sv.lproj:
/* push stuff */
"PushMessageMultiple" = "%# nya händelser";
"PushMessageSingle" = "1 ny händelse";
In my Localizable.strings in en.lproj:
/* push stuff */
"PushMessageMultiple" = "%# new events";
"PushMessageSingle" = "1 new event";
Here is a picture of the screen with a notification that works (Swedish)
http://img267.imageshack.us/i/img0014b.png/
Here is a picture of the screen with a notification that doesn't work (English)
http://img696.imageshack.us/i/img0015i.png/
Any idea why I get a constant instead of a message?
Try to use:
NSLocalizedString(#"PushMessageMultiple",#"");
This will dynamicaly get the correct string.