Equivalent java code for IMAP command - jakarta-mail

We are using Godaddy email server. We are trying fetch emails using IMAP protocol . Following are my sample IMAP commands
a select inbox
a UID SEARCH FROM "user1#server.com"
Results are getting fine for above commands something like below
* SEARCH 501 505 342 229 191
a OK SEARCH done.
If I write equivalent Java code for above commands , I'm getting empty results. Following is Java code.
IMAPFolder inbox = store.getFolder("INBOX");
SearchTerm fromTerm = new FromTerm(new InternetAddress("user1#server.com"));
Message[] messages = inbox.search(fromTerm);
The generated IMAP command for above Java code is
a SEARCH FROM user1#server.com ALL
but UID is missing in above java generated command so I'm getting empty results . How to include UID while using with Java
Thanks

The UID tag in the SEARCH command indicates that UIDs should be returned instead of message sequence numbers. Since JavaMail primarily works with message sequence numbers, it doesn't support UID SEARCH. It uses the returned message sequence numbers to map to the corresponding Message objects. Nonetheless, the messages should be "found" independently of whether their UIDs or their message sequence numbers are returned. If the server is only returning results for UID SEARCH, the server is broken and you should report this server bug to GoDaddy.

Related

Sending Data in JSON schema using AT Commands

I am working on MQTT connection establishment to the server.
I need to send the data to the server in JSON schema format using AT Commands.
The module used in N58 Neoway module. Using AT Commands connection got established and for publishing data or subscribing data to/from the server, it should happen in JSON format.
The AT Command used is:
AT+MQTTPUB=1,1,<"topic_name">,<"data">
I need to send the JSON schema in the place of data.
Looking for any suggestions/help.
The source code is based on C.
The problem in sending JSON through AT commands is that it contains double quotes ", that are unfortunately interpreted according to AT commands ETSI specification as the beginning of a string parameter. So, what happens in many modules is that it is impossible so send a JSON string as a parameter.
Some modems vendors solve this issue by starting an online mode in which data can be sent rawly.
N58 uses a different strategy instead, that consists in escaping the special characters. In the AT command guide it is called data link escape.
Though the guide could be better (there's not explicit explanation of data link escape), we can infer it from the examples (see for example the one in AT+UDPSEND): in order to escape " character, just write \" as you would do in a C string. Example:
AT+MQTTPUB=1,1,"topic_name","{\"menu\":{\"id\":\"1\",\"value\":\"2\"}}"

What's the parsing rule of Google Cloud Error Report?

I log the error to Google StackDriver Logging.
But the Google Cloud Error Reporting doesn't recognise it (work for others).
Is my formatting so different that error reporter can not recognise it ?
What's the parsing rule of Google Cloud Error Report ?
The logs is:
02:05:12 ERROR application -
! #78in3pjc5 - Internal server error, for (GET) [/api/news/page/1] ->
play.api.UnexpectedException: Unexpected exception[NonNullableColumnRead: SQL `NULL` read at column 5 (JDBC type Array) but mapping is to a non-Option type; use Option here. Note that JDBC column indexing is 1-based.]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:247)
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:178)
at play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:363)
at play.core.server.AkkaHttpServer$$anonfun$1.applyOrElse(AkkaHttpServer.scala:361)
at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:413)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
Caused by: doobie.util.invariant$NonNullableColumnRead: SQL `NULL` read at column 5 (JDBC type Array) but mapping is to a non-Option type; use Option here. Note that JDBC column indexing is 1-based.
at doobie.util.meta$Meta.unsafeGetNonNullable(meta.scala:50)
at doobie.util.composite$Composite$$anon$6$$anon$7.$anonfun$get$3(composite.scala:121)
at doobie.util.composite$Composite$$anon$6$$anon$7.$anonfun$get$3$adapted(composite.scala:121)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3(kernel.scala:80)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3$adapted(kernel.scala:80)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3(kernel.scala:80)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3$adapted(kernel.scala:80)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3(kernel.scala:80)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3$adapted(kernel.scala:80)
at doobie.util.kernel$Kernel$$anon$6.$anonfun$get$3(kernel.scala:80)
Could you provide the full log entry (e.g. as it appears then fully expanded in https://console.cloud.google.com/logs)?
The problem doesn't appear to be in the format of the stacktrace. The error is captured by if I:
go to the Cloud Console API explorer
enter "projects/[PROJECT_NAME]" for projectName
copy your content (i.e. starting from 02:05:12)
replace newlines with "\n"
paste that as a message in the Request Body
hit "Execute"

Is there an output list of "sp_send_dbmail"?

I wanna know output list of sp_send_dbmail, for example when I run sp_send_dbmail and the output is 0 it was successful, also if the output is 20, it did not find the recipients.
So I want to know if there is a list of output for sp_send_dbmail
According to MS Documentation, sp_send_dbmail() returns 0 if the process of sending mails could be started without error. This means, mails have been set in the database mail queue, and for every mail the mailitem_id for the message is returned in the result set.
Any return value other than 0 means error. The precise error code of the failed statement can be seen in ##ERROR.
After using sp_send_dbmail(), the mail is sent asynchronously and it still can fail for many reasons. So if sp_send_dbmail() returns 0, it does not mean final success.
You might look in msdb.dbo.sysmail_faileditems as in the case of error, the mails would be there (http://www.sqlservercentral.com/Forums/Topic1030781-23-1.aspx).

SQL Server --- using raiserror without status accident

I wanted to user RAISERROR in my SQL-Server codes but I noticed that some status code have interruption with built-in SQL Error statuses...
for example status code "1" is used for "Devide By Zero Error", And I dont wanna use it any more...
now I want to see what status codes are safe to use withour interruption ?
If you want to use your own msgid use a value of greater then 50000. The values below 50000 are reserved for built in messages. To see the list of existing messages you can do a 'select * from sys.messages'. 50000 is used when a value for msgid is not provided.

How do I get more info for 'invalid format' error with onpladm on Windows?

This is my first time trying to use Informix. I have around 160 tables to load, using pipe-delimited text files. We have an older series of batch files that a previous developer wrote to load Informix data, but they're not working with the new version of Informix (11.5) that I installed. I'm running it on a Windows 2003 server.
I've modified the batch file to execute the onpladm commands for one file, so this batch file looks like this:
onpladm create project dif31US-1-table-Load
onpladm create object -F diffdbagidaxsid.dev
onpladm create object -F diffdbagidaxsid.fmt
onpladm create object -F diffdbagidaxsid.map
onpladm create object -F diffdbagidaxsid.job
When I run this, it successfully creates the project and device array,
but I get an error creating the format. The only error I get is:
Create object DELIMITEDFORMAT diffile1fmt failed!
Invalid format!
The diffdbagidaxsid.fmt file is as follows:
BEGIN OBJECT DELIMITEDFORMAT diffile1fmt
PROJECT dif31US-1-table-Load
CHARACTERSET ASCII
RECORDSTART
RECORDEND
FIELDSTART
FIELDEND
FIELDSEPARATOR |
BEGIN SEQUENCE
FIELDNAME agid
FIELDTYPE Chars
END SEQUENCE
BEGIN SEQUENCE
FIELDNAME axsid
FIELDTYPE Chars
END SEQUENCE
END OBJECT
As you can see, it is only 2 columns. It originally had nothing following the CHARACTERSET. I've tried it with ASCII, and with the numeric code for ASCII, and still get the same error.
Is there any way to get a more verbose error message?
Also, can anyone recommend a decent (meaning active community) forum for Informix? I've tried the old comp.databases.informix forum, http://www.dbforums.com, the 'official' forum on IBM DeveloperWorks, and here of course. None have very much activity. We have to do this testing because we have customers (or maybe just 1 big one) who uses it, so we have to test our data and API against it.
Succinctly, I don't think there is a way to get much more information out of onpladm.

Resources