How to know at runtime whether a Kony app was built in debug or release mode



  • I'd like to be able to determine programmatically whether the app was built in debug or release mode. I'd like to be able to write something like:

    <pre class="lang-js prettyprint-override">```
    if(isDebug) {
        //do domething.
    }
    else {
        //do something else.
    }
    
    


  • After using the Chrome debugger I was able to unearth the solution. There's a constant set during the build process which you can query in order to determine whether the app has been built in debug or release mode.

    <pre class="lang-js prettyprint-override">```
    if(kony.constants.RUNMODE === "debug") {
        //do domething.
    }
    else {
        //do something else.
    }
    
    


最新帖子

最新内容

  • S

    I'm sending a pdf file from my java server to an android client. However when I look at the pdf file on the phone, the text is sometimes wrong (just some random symbols). Does someone know what is causing that problem?

    Here is the code of the server:

    private void sendPdfToPhone(File pdf) { try { InputStream iS = new FileInputStream(pdf); DataOutputStream dOS = new DataOutputStream(new BufferedOutputStream(this.clientSocket.getOutputStream())); String filename = pdf.getName(); byte[] bytes = new byte[(int) pdf.length()]; dOS.writeUTF(filename); dOS.writeLong(bytes.length); byte[] buffer = new byte[8192]; int bytesRead; int bytesSent = 0; while ((bytesRead = iS.read(buffer)) > 0) { dOS.write(buffer, 0, bytesRead); bytesSent += bytesRead; } dOS.close(); logger.debug("Sent file " + filename + " to Client: " + bytesSent + " / " + bytes.length); } catch (IOException ex) { logger.fatal(ex); } }

    And this is the code of the Android client:

    int bytesRead; String filename = dIS.readUTF(); long fileSize = dIS.readLong(); byte[] buffer = new byte[1024]; File pdf = new File(context.getCacheDir() + "/" + filename); if (!pdf.exists()) { pdf.createNewFile(); FileOutputStream fOS = new FileOutputStream(pdf); while (fileSize > 0 && (bytesRead = dIS.read(buffer, 0, (int) Math.min(buffer.length, fileSize))) != -1) { fOS.write(buffer, 0, bytesRead); fileSize -= bytesRead; } dIS.close(); dOut.close(); } pdfFile = pdf; socket.close(); return pdf;

    read more
  • S

    As there could be more than one result set, SimpleJdbcCall returns an object in the arraylist within another map marked as "#result-set-1". To access the values in it, try the following:

    ArrayList arrayList = new ArrayList(); arrayList = (ArrayList) resultFromProcedure.get("#result-set-1"); Map resultMap = (Map) arrayList.get(0); System.out.println("Account Number: " + resultMap.get("accountnumber"));

    read more
  • S

    If I understand this correctly; Map<String, Object> resultFromProcedure consist of 2 entries having keys #result-set-1 and #update-count-1.

    And the object of #result-set-1 is an object having 4 member variables. (If it is a String, then you'd need to convert the Json to a Java Object (Example))

    Thus your call to resultFromProcedure.get("accountnumber") is trying to fetch an object using the key accountnumber, but the map doesn't contain that key. You need to first get the object for #result-set-1 e.g.

    SomeDTO someDTO = resultFromProcedure.get("#result-set-1");

    Then you can call

    someDTO.getAccountNumber();

    read more
  • S

    When executing SimpleJdbcCall, I get two parameters #result-set-1, #update-count-1

    MapSqlParameterSource parameterSource = new MapSqlParameterSource(); parameterSource.addValue("name", "something"); Map<String, Object> resultFromProcedure = cstmt.execute(parameterSource); #result-set-1 have variables [{ id = 123, name = "something", accountnumber = 123456, balance = 789999 }]

    Everything is fine until I tried to access

    resultFromProcedure.get("accountnumber")

    Which getting null. The Question is how to access the values in #result-set-1

    read more
  • S

    Fpdf library isn't provided with Codeigniter. You must install/copy in the application/libraries folder before you can load it.

    read more

推荐阅读

  • 6
  • 1
  • 2
  • 2
  • 2
  • 4
  • 18
  • 1