I have a DB that must be full text indexed, so I added the code below to create one if it is not allready indexed:
if (database.isFTIndexed()){
database.updateFTIndex(false)
} else {
var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES + database.FTINDEX_IMMEDIATE
database.createFTIndex(options , true);
database.updateFTIndex(false);
}
sessionScope.put("ssSelectedView","vwWFSProfile")
When it runs I get the following error:
Error source
Page Name:/xpWFSAdmin.xsp
Control Id: button2
Property: onclick
Exception
Error while executing JavaScript action expression
com.ibm.jscript.types.GeneratedWrapperObject$StaticField incompatible with com.ibm.jscript.types.FBSValue
Expression
1: #{javascript:if (database.isFTIndexed()){
2: database.updateFTIndex(false)
3: } else {
4: var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES + database.FTINDEX_IMMEDIATE
5: database.createFTIndex(options , true);
6: database.updateFTIndex(false);
7: }
8: sessionScope.put("ssSelectedView","vwWFSProfile")}
It is choking on line 4 it does not like the summing of the parameters. So I comment out line 4 and change line 5 to read database.createFTIndex(4, true)
then I get this error:
Error while executing JavaScript action expression
Script interpreter error, line=5, col=18: [TypeError] Exception occurred calling method NotesDatabase.createFTIndex(number, boolean) null
JavaScript code
1: if (database.isFTIndexed()){
2: database.updateFTIndex(false)
3: } else {
4: //var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES + database.FTINDEX_IMMEDIATE
5: database.createFTIndex(4 , true);
6: database.updateFTIndex(false);
7: }
8: sessionScope.put("ssSelectedView","vwWFSProfile")
Can't seem to get it to work. I can go into the DB and manually create the index so it is not a rights issue.
As far as I can read from the help, you can not use database.FTINDEX_IMMEDIATE as parameter for createFTIndex() only for setFTIndexFrequency().
So remove the use of database.FTINDEX_IMMEDIATE and do this:
var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES;
database.createFTIndex(options , true);
You can then call setFTIndexFrequency() like this:
database.setFTIndexFrequency(database.FTINDEX_IMMEDIATE);
Related
why the second switch code can run when t value not 30, program should return in the first swtich statement, it seems wild.
following is the code:
package main
import (
"fmt"
)
func main() {
fmt.Println("start...")
// change different t value to test
t := 10
switch t {
case 10:
case 20:
case 30:
fmt.Println("30...")
return
default:
fmt.Println("d...")
return
}
fmt.Println("does the following code run ?")
switch t {
case 10:
fmt.Println("10....")
case 20:
fmt.Println("20....")
}
fmt.Println("end...")
}
Hi everyone,
I am trying to test C programs that use an user input... Like a learning app. So the avaliator(teacher) can write tests and I compile the code with a help of a docker and get back the result of the program that I send. After that I verify if one of the case tests fails..
for that I have two strings, like this:
result = "input_compiled1540323505983: /home/compiler/input/input.c:9: main: Assertion `B==2' failed. timeout: the monitored command dumped core Aborted "
and an array with case tests that is like:
caseTests = [" assert(A==3); // A must have the value of 3;", " assert(B==2); // B must have the value of 2; ", " assert(strcmp(Fulano, "Fulano")==0); //Fulano must be equal to Fulano]
I need to send back from my server something like this:
{ console: [true, true, true ] }
Where each true is the corresponding test for every test in the array of tests
So, I need to test if one string contains the part of another string... and for now I did like this:
criandoConsole = function(arrayErros, arrayResult){
var consol = arrayErros.map( function( elem ) {
var local = elem.match(/\((.*)\)/);
if(arrayResult.indexOf(local) > -1 ) {
return false;
}
else return true;
});
return consol;
}
I am wondering if there are any more efective way of doing that. I am using a nodejs as server. Does anyone know a better way?!
ps: Just do like result.contains(caseTests[0]) did not work..
I know this is changing the problem, but can you simplify the error array to only include the search terms? For example,
result = "input_compiled1540323505983: /home/compiler/input/input.c:9: main: Assertion `B==2' failed. timeout: the monitored command dumped core Aborted ";
//simplify the search patterns
caseTests = [
"A==3",
"B==2",
"strcmp(Fulano, \"Fulano\")==0"
]
criandoConsole = function(arrayErros, arrayResult){
var consol = arrayErros.map( function( elem ) {
if (arrayResult.indexOf(elem) != -1)
return false; //assert failed?
else
return true; //success?
});
return consol;
}
console.log(criandoConsole(caseTests,result));
I've scoured the internet but it seems that I can't find documentation for the different types of Knex errors.
I would like to know these so I can implement proper error handling for my project. Where can I find this? They briefly mention the query error object here but no further depth is given. Am I missing something? It seems basic to me that they should have this well-documented.
What #Mikael said. It's a passthrough. For SQLite there are lists of DB errors here and here.
The db error code is included on the thrown exception object as the attribute .errno. I use this and the db driver documentation to be more verbose about the errors with the following function:
/**
* Gets Error strings using DB driver error number
* #param {number} errNo Database error number
* returns {object} errs: {"int":"Internal use string", "ext":"External usage string"};
*/
function getDBError(errNo) {
if (!errNo) {errNo = 0; };
let errs = {"int":null, "ext":null};
switch(errNo) {
case 2: errs.int="Internal logic error in SQLite"; break;
case 3: errs.int="Access permission denied"; break;
case 4: errs.int="Callback routine requested an abort"; break;
case 5: errs.int="The database file is locked"; break;
case 6: errs.int="A table in the database is locked"; break;
case 7: errs.int="A malloc() failed"; break;
case 8: errs.int="Attempt to write a readonly database"; break;
case 9: errs.int="Operation terminated by sqlite3_interrupt()"; break;
case 10: errs.int="Some kind of disk I/O error occurred"; break;
case 11: errs.int="The database disk image is malformed"; break;
case 12: errs.int="Unknown opcode in sqlite3_file_control()"; break;
case 13: errs.int="Insertion failed because database is full"; break;
case 14: errs.int="Unable to open the database file"; break;
case 15: errs.int="Database lock protocol error"; break;
case 16: errs.int="Database is empty"; break;
case 17: errs.int="The database schema changed"; break;
case 18: errs.int="String or BLOB exceeds size limit"; break;
case 19: errs.int="Abort due to constraint violation"; break;
case 20: errs.int="Data type mismatch"; break;
case 21: errs.int="Library used incorrectly"; break;
case 22: errs.int="Uses OS features not supported on host"; break;
case 23: errs.int="Authorization denied"; break;
case 24: errs.int="Auxiliary database format error"; break;
case 25: errs.int="2nd parameter to sqlite3_bind out of range"; break;
case 26: errs.int="File opened that is not a database file"; break;
case 27: errs.int="Notifications from sqlite3_log()"; break;
case 28: errs.int="Warnings from sqlite3_log()"; break;
case 100: errs.int="sqlite3_step() has another row ready"; break;
case 101: errs.int="sqlite3_step() has finished executing"; break;
case 301: errs.int="no such column"; break;
case 302: errs.int="no such table"; break;
case 303: errs.int="Cannot start a transaction within a transaction"; break;
default: errs.int="Database processing Error #"+errNo; break;
}
// errs.ext is future use to include end user messages and is currently ignored
if (!errs.ext) {errs.ext = errs.int; };
return errs;
};
There is no documentation of different errors thrown by knex. There are not that many places where knex actually creates Errors, usually its some other package where error is originated, except for some validations that feature is supported by the selected driver.
If a query fails, knex just passes the original error that was thrown by the database driver.
I have following Structure:
Each single functionality is broken down in Reusable script and reusing all in the Main Suite.
TestCase 1:
1. Login as Normal Customer (This is calling login test case from Reusable script)
2. Extract Session from STEP 1
3. Add diner card (This is calling add card test case from Reusable script)
4. View Added Card (This is calling view test case from Reusable script)
5. etc..
Now Each test case in Reusable script returns a property that r_result (Passed or Failed)
Now I wanted to check each run test case and see the property r_result is Passed or Failed. If It is failed, I need to check where the First Failed occurs (in RunTestCase) and report that error.
Is It possible to isolate ONLY RunTestCase steps in each Test case and use it in closure to get the results of each RunTestCase results?
Here is the script which can fetch the list of matching test steps across the soapui project.
Please follow the in-line comments.
result variable has all the list of test steps of required type. The you can leverage and do the needful using this data.
Script:
import com.eviware.soapui.impl.wsdl.teststeps.WsdlRunTestCaseTestStep
//To identify lookup test step is not this step
def currentStepMap = [ suite : context.testCase.testSuite.name, case : context.testCase.name, step : context.currentStep.name ]
//Type of step to look for
def stepTypes = [WsdlRunTestCaseTestStep]
//To hold the final result
def result = []
//Find the test step details of matching step
def getMatchingMap = { suite, kase, step ->
def tempMap = [suite : suite.name, case : kase.name, step: step.name]
def isNotMatching = currentStepMap != tempMap ? true : false
if (isNotMatching &&(stepTypes.any{step in it}) ) {
tempMap
} else { [:] }
}
def project = context.testCase.testSuite.project
//Loop thru the project and find the matching maps and list them
project.testSuiteList.each { suite ->
suite.testCaseList.each { kase ->
kase.testStepList.each { step ->
def tempResult = getMatchingMap(suite, kase, step)
if (tempResult) {
result << tempResult
}
}
}
}
if (result) {
log.info "Matching details: ${result} "
} else {
log.info "No matching steps"
}
I have a View Panel in a tabbed panel that has the data > var property set to rowData. I have this view set to mimic the Single Category view by using a viewScope value.
When I open a XPage and click on the tab which the view panel exists, sometimes this error pops up (line 2 in the JavaScript Code is where the error is):
Unexpected runtime error
The runtime has encountered an unexpected error.
Error source
Page Name:/speakerReq.xsp
Control Id: viewColumn2
Exception
Error while executing JavaScript computed expression
Script interpreter error, line=2, col=23: [ReferenceError] 'rowData' not found
JavaScript code
1: var href = facesContext.getExternalContext().getRequest().getContextPath();
**2: var docUNID = rowData.getDocument().getUniversalID();**
3: var formName = rowData.getDocument().getItemValueString("Form");
4: var formType = rowData.getColumnValue("Form")
5:
6: if(formName == "clientProfile") {
7: href + "/clientProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
8: }
9: else {
10: href + "/speakerProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
11: }
The viewColumn2 that is referenced above is a column in the view which has this formula:
#ReplaceSubstring(Form; "clientProfile" : "clientFeed" : "speakerProfile" : "speakerFeed"; "Client Profile" : "Client Feedback" : "Speaker Profile" : "Speaker Feedback")
I am not sure how that would throw the error above --- clicking on that tab on most XPages works fine.
The documents that are being displayed in the view are nothing special. I compared two of them -- one that displays and one that throws the error and I could not find any differences that would cause this problem.
I cannot determine why sometimes the error appears and sometimes not.
Any help would be great!
try to use a different variable name curRowData --- and don't forget that stuff is case sensitive. Also your code is a big fat memory leak since rowData.getDocument initializes a NotesDocument that you don't recycle.
Try to use:
var result;
if (curRowData.isCategory()) {
return "";
}
var href = facesContext.getExternalContext().getRequest().getContextPath();
try {
var doc = curRowData.getDocument();
if (doc != null) {
var docUNID = doc.getUniversalID();
var formName = doc.getItemValueString("Form");
var formType = curRowData.getColumnValue("Form")
if(formName == "clientProfile") {
result = href + "/clientProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
} else {
result = href + "/speakerProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
}
}
} catch (e) {
// some error handling
}
if (doc != null) {
doc.recyle();
}
return result;
Of course you would be better off just to add all values you need to the view. Saves you the need to create a NotesDocument object
Perhaps this error occurs if the view is categorized and the code hits a category and not a document. You can use the folllowing code to make sure that the current row is not a category:
if (!rowdata.isCategory()) {
// insert your code here
}
This code of course assumes that rowData is available so this might not solve your issue.
Example code can be found in the Notes & Domino Application Development wiki:
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/notesxspviewentry_sample_javascript_code_for_xpages#isCategory+isDocument+isTotal
Please add a description of the XML declaring the control.
I have myself gotten this error and it was because I computed the column in a wrong way; "Computed" vs JavaScript I think it was…