Application crashes in IBM Mobilfirst - jquery-mobile

I am developing a hybrid application with IBM Worklight 7.0.
I am searching with the following command from the local store with the following code. This code works by pressing each button on the screen. After the user has been running for a while, the application crashes. Does this cause a search with "like" command? Does the this code work asynchronously?
My Code :
var queryPart = WL.JSONStore.QueryPart().like('name', str).like('type',
typeStr);
WL.JSONStore.get(allReason.name).advancedFind([queryPart]).
then(function(arrayResults) { ... }
Logcat :
E/SQLiteLog( 1481): (10) POSIX Error : 11 SQLite Error : 3850
D/NONE (26304): reasons event binded!
D/PhoneWindow(26304): *FMB* installDecor mIsFloating : true
D/PhoneWindow(26304): *FMB* installDecor flags : 8388610
W/ResourceType(26304): Failure getting entry for 0x01080ad0 (t=7 e=2768)
(error -75)
D/InputDispatcher( 898): Focus left window: 26304
D/InputDispatcher( 898): Focus entered window: 26304
D/PhoneWindow(26304): *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
D/PhoneWindow(26304): *FMB* isFloatingMenuEnabled return false
D/NONE (26304): Request [/apps/services/api/Bukalemun/android/ heartbeat]
I/System.out(26304): Thread-1548(ApacheHTTPLog):isSBSettingEnabled false
I/System.out(26304): Thread-1548(ApacheHTTPLog):isShipBuild true
I/System.out(26304): Thread-1548(ApacheHTTPLog):SMARTBONDING_ENABLED is
false
I/System.out(26304): Thread-1548(ApacheHTTPLog):SmartBonding Enabling is
false, SHIP_BUILD is true, log to file is false, DBG is false
D/Netd ( 256): getNetworkForDns: using netid 0 for uid 10187
I/System.out(26304): pool-5-thread-6 calls detatch()
D/HttpPostRequestSender(26304): WLHybridRequestSender.run in
WLHybridRequestSender.java:42 :: Sending request
http://
xxxx.org.tr:80 /Bukalemun/apps/services/api/Bukalemun/android/heartbeat
E/NONE (26304): [/apps/services/api/Bukalemun/android/heartbeat] Host is
not responsive. Try to manually access the URL through the android emulator
browser to verify connectivity.
D/NONE (26304): Failed to send heartbeat
Below is the code that pulls the data to the selectboxes.
var queryPart = WL.JSONStore.QueryPart().like('name', regexStr3).like('type',
asansorTipi);
WL.JSONStore.get(allReason.name).advancedFind([queryPart]).then(function(arrayResults) {
// if data not present , get the data from DB
if (arrayResults.length == 0) {
} else {
var myLikeReasonId = arrayResults[0].json.reasonid;
if(myLikeReasonId != null && myLikeReasonId != ' '){
tmpVal = myLikeReasonId +','+ '2';
reasonValue = tmpVal.split(',');
$("#"+reasonValue[0]).each ( function() {
if(reasonValue[1] == 1 || reasonValue[1] == 2 || reasonValue[1] == 3){
$(this).val(reasonValue[1]).change();
if(reasonValue[1] == "2") {
uygundegil = true;
uygunDegilArray.push(reasonValue[0]);
} else if(reasonValue[1] == "3"){
uygulanamaz = true;
uygulanamazArray.push(reasonValue[0]);
} else {
uygun = true;
uygunArray.push(reasonValue[0]);
}
}
});
} else {
WL.Logger.error("collection filter returns null result.");
}
}
}).fail(function(errorObject) {
WL.Logger.error("fail" + errorObject);
});

By looking up the error code: 3850. It seems there is an IO lock problem. I would surround your code with a try{}catch() and if you receive the 3850 error, wait and try the process again.
The SQLITE_IOERR_LOCK error code is an extended error code for SQLITE_IOERR indicating an I/O error in the advisory file locking logic. Usually an SQLITE_IOERR_LOCK error indicates a problem obtaining a PENDING lock. However it can also indicate miscellaneous locking errors on some of the specialized VFSes used on Macs.

Related

How can I determine the debugged program/process in handlers of EnvDTE.Events.DebuggerEvents?

I am creating a Visual Studio Extension that performs some tasks when debugging of a specific application is stopped. This is my code for handling the debugger event:
...
DTE2 ide = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2;
if (ide != null)
{
debuggerEvents = ide.Events.DebuggerEvents;
debuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode;
}
}
private static void DebuggerEvents_OnEnterDesignMode(dbgEventReason Reason)
{
ThreadHelper.ThrowIfNotOnUIThread();
DTE2 ide = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2;
if (ide != null && ide.Debugger.CurrentProcess != null)
{
DebuggedProcName = ide.Debugger.CurrentProcess.Name;
}
if (Reason == dbgEventReason.dbgEventReasonStopDebugging &&
DebuggedProcName == "MyApp")
{
...
}
}
The problem is that ide.Debugger.CurrentProcess and .CurrentProgram is null in OnEnterDesignMode(). They are not null in OnEnterBreakMode() but that one might not be called. How can I determine the currently debugged program/process in a Visual Studio extension?
I wanted to perform a specific task if debugging of a certain project is stopped. Since using the event handler seems impossible I helped myself with a menu command that is executed when I press Ctrl + F5. After performing the task this command also kills the debugged process which effectively stops debugging. Rather rude, I guess, but I can live with this solution.

Basic Use of Tmp-String-0

I'm trying to use the Tmp-String-0 variable within a dhcp site enabled.
My version is old and in production (2.1.12).
Here is the content of my dhcp file.
dhcp DHCP-Discover {
update control{
Tmp-String-0 = "%{sql: CALL sqlprocedure('%{DHCP-Agent-Circuit-Id}','%{DHCP-Gateway-IP-Address}','%{DHCP-Relay-Remote-Id}')}"
}
if(control:Tmp-String-0 != "" ) {
update reply {
DHCP-Message-Type = DHCP-Offer
}
}
else {
update reply {
DHCP-Message-Type = DHCP-NAK
}
}
update reply {
DHCP-Your-IP-Address = "control:Tmp-String-0"
}
}
And here is the result I have in debug mode.
rlm_sql_mysql: query: CALL sqlprocedure('value','1.2.3.4','value')
sql_xlat finished
rlm_sql (sql): Released sql socket id: 4
expand: %{sql: CALL sqlprocedure('%{DHCP-Agent-Circuit-Id}','%{DHCP-Gateway-IP-Address}','%{DHCP-Relay-Remote-Id}')} -> 10.10.10.10
++[control] returns noop
++? if (control:Tmp-String-0 != "" )
? Evaluating (control:Tmp-String-0 != "" ) -> TRUE
++? if (control:Tmp-String-0 != "" ) -> TRUE
++- entering if (control:Tmp-String-0 != "" ) {...}
+++[reply] returns noop
++- if (control:Tmp-String-0 != "" ) returns noop
++ ... skipping else for request 445: Preceding "if" was taken
ERROR: Failed parsing value "control:Tmp-String-0" for attribute DHCP-Your-
IP-Address: Failed to find IP address for control:Tmp-String-0
++[reply] returns fail
I don't know what is wrong with that maybe I should use the operator "=" instead of ":=".
What do you think?
Many thanks, Will
Did you try the following
update reply {
DHCP-Your-IP-Address = "Tmp-String-0"
}

Run socket Server in a ionic1 application

Here is the requirement:
Start a socket server in the app which will receive messages from another app running in the same device.
Here is the stack:
Ionic1/cordova
Angular1
cordova plugin: https://www.npmjs.com/package/cordova-plugin-chrome-apps-sockets-tcpserver
Using the chrome's tcpServer plugin, I ended this code:
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
var tcpServer = window.chrome && window.chrome.sockets &&
window.chrome.sockets.tcpServer;
if(tcpServer) {
console.log('LOG tcpServer present')
tcpServer.create({}, function (createInfo) {
var serverSocketId = createInfo.socketId;
console.log('LOG', 'serverSocketId', serverSocketId)
if (serverSocketId > 0) {
tcpServer.listen(serverSocketId, '0.0.0.0', 8080, 50, function(resultCode) {
console.log('LOG', 'listening', resultCode)
});
} else {
console.log('LOG', 'Unable to create socket');
}
});
} else {
console.log('LOG', 'missing chrome.sockets.tcpServer')
}
});
})
And the result of this code is:
LOG tcpServer present
LOG serverSocketId 0
LOG Unable to create socket
Given that I've no experience in ionic1/iOS:
Is this my option to create this socket server?
0 means that the create method failed. What could I be doing wrong here?
Do I need some special permission in iOS to perform those actions? (Similar to Android)
I couldn't find resources/examples to help me doing this. Where should I search?
Any help is appreciated

Parse server return invalid session token for public records and only when calling functions

ok this is something that start to show a few weeks ago, I have a parse server running on an ubuntu machine with version 2.3.3, I have a bunch of cloud functions running, nothing fancy just querying some specific Class, all the data in that class is public and all work most of the time just fine. However from time to time, calling a cloud function start to return invalid sessions error 209, even with a user logged or not, super weird, but what is even strange is that when that happens no one else can run the function, and every user start to got the same error.
The only way I can make it work again is restarting the server, also only happens with cloud functions and from the ios app, I saying this cause we have some other part calling functions from php but it seems those are not starting the problem
2017-02-21T01:26:57.676Z - Failed running cloud function partnersv2 for user undefined with:
Input: {"k":"","searchType":"","category":"comida"}
Error: {"code":141,"message":{"code":209,"message":"invalid session token"}}
2017-02-21T01:26:57.669Z - invalid session token
2017-02-21T01:26:55.738Z - ParseError { code: 209, message: 'invalid session token' }
2017-02-21T01:26:55.737Z - Error generating response. ParseError {
code: 141,
message: ParseError { code: 209, message: 'invalid session token' } }
I have no idea why is this happening, also I don't think is related to the legacy session cause this server and the user are new, we start developing this a few months ago is not a ported app from the old service
One thing we are doing a lot is removing from the dashboard sessions at will, cause we are testing and developing, not sure if this could be a reason, but what about when the user is undefined, it shouldn't even try to use session I think, or maybe a user that was actually logged could be the culprit, setting the server to VERBOSE is not telling anything else as well, just the params and the call which it doesn't look weird to me, am looking for someone that maybe can put me in the right direction of maybe how the session work or something, thank you for any help
EDIT 1:
This is the cloud function that is trowing the error
Parse.Cloud.define('partnersv2', function (req, res) {
var searchType = req.params.searchType,
k = req.params.k,
category = req.params.category,
query;
query = new Parse.Query('Partner');
query.addDescending('is_open');
query.equalTo('enabled', true);
query.equalTo('category', category);
query.select(['name', 'phone', 'delivery_eta', 'keys', 'price_range', 'is_new', 'cover', 'recommended', 'open_time', 'min_order', 'delivery_rank', 'logo', 'comingsoon', 'category', 'is_open']);
if (searchType !== '' && searchType !== undefined && k !== '' && k !== undefined) {
if (searchType === 'Tag') {
query.equalTo('tags', k);
} else {
query.equalTo('name', k);
}
}
query.limit(1000);
query.find({
success: function (results) {
if (results.length > 0) {
res.success(results);
} else {
res.error('404 not found');
}
},
error: function (error) {
res.error(error);
}
});
});
and this is a screenshot of the ACL col
Use Master Key
Parse.Cloud.define('partnersv2', function (req, res) {
//var token = req.user.getSessionToken() // getSession Token return r: (yourkey);
var searchType = req.params.searchType,
k = req.params.k,
category = req.params.category,
query;
query = new Parse.Query('Partner');
query.addDescending('is_open');
query.equalTo('enabled', true);
query.equalTo('category', category);
query.select(['name', 'phone', 'delivery_eta', 'keys', 'price_range', 'is_new', 'cover', 'recommended', 'open_time', 'min_order', 'delivery_rank', 'logo', 'comingsoon', 'category', 'is_open']);
if (searchType !== '' && searchType !== undefined && k !== '' && k !== undefined) {
if (searchType === 'Tag') {
query.equalTo('tags', k);
} else {
query.equalTo('name', k);
}
}
query.limit(1000);
query.find({
useMasterKey: true, // sessionToken: token
success: function (results) {
if (results.length > 0) {
res.success(results);
} else {
res.error('404 not found');
}
},
error: function (error) {
res.error(error);
}
});
});

NativeScript firebase: Firebase instance is not persisted in background service while application is closed

I'm trying to tap on the incoming call using a following background service in NativeScript and searching the incoming number in Firebase Database.
The firebase.query from nativescript-plugin-firebase code works fine if the application UI is visible or minimized in Android but when the application is closed (however, the service is running in background), it throws firebase.query: TypeError: Cannot read property 'child' of null error. Any Idea.
app/broadcastreceivers/NotificationEventReceiver.js:
var application = require("application");
var firebase = require("nativescript-plugin-firebase");
var incomingCallDetected = false;
var TelephonyManager = application.android.context.getSystemService(android.content.Context.TELEPHONY_SERVICE);
android.support.v4.content.WakefulBroadcastReceiver.extend("com.tns.broadcastreceivers.NotificationEventReceiver", {
onReceive: function (context, intent) {
if (intent.getAction() === 'android.intent.action.PHONE_STATE') {
incomingCallDetected = true;
}
}
});
var callStateListener = android.telephony.PhoneStateListener.extend({
onCallStateChanged: function (state, phoneNumber) {
if (incomingCallDetected && state === 1) { // incoming call ringing
firebase.query(
function(result) {
console.log(JSON.stringify(result));
},
"/calls",
{
singleEvent: true,
orderBy: {
type: firebase.QueryOrderByType.CHILD,
value: 'PhoneNumber'
},
range: {
type: firebase.QueryRangeType.EQUAL_TO,
value: phoneNumber.replace(/\s+/g, '').substr(-10)
}
}
);
incomingCallDetected = false;
}
}
});
TelephonyManager.listen(new callStateListener(), android.telephony.PhoneStateListener.LISTEN_CALL_STATE);
Update: This line in nativescript-plugin-firebase causes the problem because firebaseInstance does not persist in the service once the application is closed.
I think thats because the firebase is never initiated in background service, I guess you are doing it only in app code so it works when it is on foreground.

Resources