We are able to get the user agent from device via calling
System.getProperty("browser.useragent")
This method is available for OS 4.7 +
I only tested it on some of the Blackberry simulators: 9530 (os 4.7), 9800 (os 6.0.0)
It works as a charm.
But as far as I know that on real devices, if user changes the blackberry browser, the user agent in the http request to server will be changed. For instance, some of the blackberry devices use Firefox browser.
Therefore I would like to know, if browser setting is changed on the real device, when we call System.getProperty("browser.useragent"), will the return value change???
Has anyone tested on the real device?
or does anyone know the anwser.
You could test this out in a Simulator of your choice by creating an App that logs or prints to screen the value of System.getProperty("browser.useragent") then making your noted change in the simulator.
this is an example:
public static String getSystemUserAgent(){
String agent = "";
if(System.getProperty("browser.useragent")!=null){
agent = System.getProperty("browser.useragent");
}else if(GI.isScreenSmall()){
agent = "BlackBerry8100/4.5.0.180 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/215";
}else{
agent = "BlackBerry8300/4.2.2Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/107UP.Link/6.2.3.15.0";
}
return agent;
}
you can construct the UserAgent with this method
private static String getUserAgent() {
String userAgent = "Blackberry" + DeviceInfo.getDeviceName() + "/" +
DeviceInfo.getSoftwareVersion() + " Profile/" + System.getProperty(
"microedition.profiles" ) + " Configuration/" + System.getProperty(
"microedition.configuration" ) + " VendorID/" +
Branding.getVendorId();
}
Related
The Company I work for uses Jira to support the requirement capture & test phases of a project. We assign stories (i.e. requirements) to a release. As a Test Engineer, I raise bugs which I then reference in the story as "Is Blocked By".
I need to create a report which lists each of the releases and the stories associated with that release. As I raise bugs, I need the report to also be populated by the bugs (or actually any other issue raised).
I cannot see a way of doing this within Jira directly but I have found a Jira module for Python... I've got the following working but now I'm stuck;
from jira import JIRA
server = {"server" : "https://jira.pxr5.hw"}
login = ('bob', 'dave')
jira = JIRA (options = server, basic_auth = login)
myProject = jira.project ("QSC")
for eachVersion in myProject.versions:
print eachVersion.name + " - " + eachVersion.id
This produces the expected output;
Release 0 - 10518
Release 0.1 - 10602
Release 0.2 - 10603
Release 1.0 - 10519
Release 2.0 - 10520
Release 3.0 - 10521
closed - 10616
work complete - 10617
From the documentation I've found, I cannot see how to return anything further by which I mean the stories under each Version and (where they exist) the bugs I've raised.
Please can you help? Thanks for your attention.
I got there in the end... Kind of... Here's a solution I found by unpicking the "raw" property...
from jira import JIRA
import sys
userName = "Dave"
userPassword = "Bob"
server = {"server" : "https://jira.pxr5.hw"}
login = (userName, userPassword)
# Open a link to Jira
jira = JIRA (options = server, basic_auth = login)
# Return an object comprising the project we're working on
myProject = jira.project ("quark")
# Get a list of the releases in the project. Notice that the version
# has to be surrounded by single quotes as it may have spaces in it
for eachVersion in myProject.versions:
jqlStatement = "project=quark AND fixVersion='" + eachVersion.name + "'"
print eachVersion.name
# Get a list of stories accociated with each release of the project
theStories = jira.search_issues (jqlStatement)
# Go through each story in the current release
for eachStory in theStories:
# The story is indented one tab with it's ID and summary name
print "\t" + eachStory.raw["key"] + " " + eachStory.raw["fields"]["summary"]
# Now get a list of issue links and go through each one
issueLinks = eachStory.raw["fields"]["issuelinks"]
for eachLink in issueLinks:
print "\t\t" + eachLink["inwardIssue"]["key"] + " " + \
eachLink["inwardIssue"]["fields"]["summary"]
Im currently implementing Branch.io to our Titanium iOS-app. Using the latest 4.8 Studio with Titanium SDK 6.0.
Everything works fine with the integration so far, except that when I try to open the app, when it's "cold dead", we're not getting the correct activityType from the created Activity.
The eventlistener of "continueactivity" is used, but the activityType is: "NSUserActivityTypeBrowsingWeb" and not the one I have specified in the Entitlements.plist-file.
Here's our current code:
var Branch = require("io.branch.sdk");
Branch.addEventListener("bio:initSession", branchInitCallback); // When opened via Branch, when app is "active"
Ti.App.iOS.addEventListener("continueactivity", branchContinueActivity); // If opened via Branch, when "hard closed"
// Create the Activity incase the app is Super-closed
var branchActivity = Ti.App.iOS.createUserActivity(
{
activityType: 'io.branch.{appname}.universalLink'
});
branchActivity.becomeCurrent();
Branch.initSession();
// Branch Callbacks
function branchInitCallback(_data)
{
Ti.API.info("inside onInitSessionFinished");
alert("init: " + JSON.stringify(_data));
console.log(_data);
if(_data)
{
if(_data["+clicked_branch_link"] != undefined && _data["+clicked_branch_link"] == 1)
{
alert("CLICKED BRANCH LINK");
}
}
}
function branchContinueActivity(e)
{
Ti.API.info("inside continueactivity: " + JSON.stringify(e));
if (e.activityType === 'io.branch.{appname}.universalLink')
{
Branch.continueUserActivity(e.activityType, e.webpageURL, e.userInfo);
}
alert("continue:" + JSON.stringify(e));
console.log(e);
var sessionParams = Branch.getLatestReferringParams();
alert("session: " + JSON.stringify(sessionParams));
console.log(sessionParams);
}
This means that the function "branchContinueActivity" is not fireing the Branch-function "continueUserActivity".
We've ofcourse added:
<key>NSUserActivityTypes</key>
<array>
<string>io.branch.{appname}.universalLink</string>
</array>
into tiapp.xml
What are we doing wrong here?
Alex from Branch.io here: without seeing more of your code, this is tough to debug. We cover a solution for this situation on our Titanium SDK docs here, and there is also a fully functional Titanium Testbed app you can use as a reference.
If you're still running into difficulties, the best option is to file a ticket with our Integrations team or an issue on the SDK GitHub repo so we can debug more easily.
I can't get why my browser console shows an error from time to time. As I can see this error doesn't break anything.
media.twiliocdn.com/sdk/rtc/js/ip-messaging/releases/0.10.6/twilio-ip-messaging.js:22423
WebSocket is already in CLOSING or CLOSED state.
Also I noticed that after some time of inactivity in chat window, I get 'messageAdded' event with a huge latency (it's take around 5+ seconds after message was sent), but Typing event works fine. Why is this happens?
Closed socket errors indicate an issue with the local network and Chrome - can you confirm if you are going through a proxy? Could you also test using Firefox if possible?
If not, can you uncheck "automatically detect settings" in the network part of the Chrome Settings? Clear the cache and then update to the latest version and try again.
As far as the messageAdded event is concerned, what does your code look like?
Adding event listeners for IP Messaging:
//set up listeners for events for the active channel
activeChannel.on('messageAdded', addMessageToHistory);
And the messageAdded method I've seen used without issue:
function addMessageToHistory(message) {
console.log('Message added, adding a message to the history, sid:' + message.sid);
//get a handle to the chat history wrapper
var $messageHistory = $('#chat-history');
//process the message elements
var $messageEntry = $('<div id="' + message.sid + '" class="chat-message clearfix"/>');
var $messageContent = $('<div class="chat-message-content clearfix"/>');
var $messageTime = $('<span id="time_' + message.sid + '" class="chat-time"/>').text(formatDate(message.timestamp));
var $messageAuthor = $('<h5/>').text(message.author);
var $messageBody = $('<p id="msgbody_" ' + message.sid + '" />').text(message.body);
var $messageSeparator = $('<hr/>');
//build the message content
$messageTime.appendTo($messageContent);
$messageAuthor.appendTo($messageContent);
$messageBody.appendTo($messageContent);
//build the message entry
$messageContent.appendTo($messageEntry);
$messageSeparator.appendTo($messageEntry);
//ad the message entry to the history
$messageEntry.appendTo($messageHistory);
//scroll to end
$messageHistory.scrollTop($('#chat-history')[0].scrollHeight);
activeChannel.updateLastConsumedMessageIndex(message.index);
}
If your problem persists, then I'd suggest you contact support where we can take a closer look.
I am building an MVC application that includes an asynchronous image upload so each image, once uploaded, calls the action. Image uploading can be cpu intensive and require time so we are trying to avoid in-action processing.
I have read about using async actions, but we are also processing images at other times, so we have opted to handle image processing through a console application.
What is the proper method for calling a console application from an MVC action asynchronously? Basically we just want to pass the console app some parameters, and tell it start without waiting for any kind of response from the console.
Our program file is an exe.
Speed is our main concern here.
Thanks so much for your help!
EDIT
As per Brian's suggestion here is what we added:
Process pcx = new System.Diagnostics.Process();
ProcessStartInfo pcix = new System.Diagnostics.ProcessStartInfo();
pcix.FileName = "C:\\utils_bin\\fileWebManager\\ppWebFileManager.exe";
pcix.Arguments = WrkGalId.ToString() + " " + websiteId.ToString() + "" + " " + "19" + " \"" + dFileName + "\" ";
pcix.UseShellExecute = false;
pcix.WindowStyle = ProcessWindowStyle.Hidden;
pcx.StartInfo = pcix;
pcx.Start();
You would use Process.Start to execute an external application, e.g.:
Process.Start(#"C:\\path\to\my\application.exe");
I am generating context menu when user selects some text and right click it. I tried implementing it, problem is even sample application is not working.
http://crossrider.com/apps/10565/ide
appAPI.contextMenu.add("key1", "Display data object", function (data) {
var sAlertText = 'pageUrl: ' + data.pageUrl + '\r\n' +
'linkUrl: ' + data.linkUrl + '\r\n' +
'selectedText:' + data.selectedText + '\r\n' +
'srcUrl:' + data.srcUrl;
alert(sAlertText);
}, ["all"]);
Only data.pageUrl is available rest of all are "undefined". I want selectedText.
Disclaimer: I work at Crossrider.
Indeed there was an issue with the contextMenu due to a change in the Chrome API.
We've fixed this and now the demo app works.
Thank you for reporting this and please feel free to let us know if you encounter any issues!
Amir