FullCalendar 5 passing classes from the server side - java

I am trying to add classes to my Event in FullCalendar version 5. When I pass to classNames:
cssItalic
It works. However when I pass:
["cssItalic"]
I does not work (i.e., the Title is not italicised). I have also tried:
['cssItalic']
I have noticed that many questions/answers on this use className (i.e., without the 's').
The reason I need to resolve this is that I want to pass more than one css, for instance:
["cssItalic", "cssUnderline"]
I am using MySQL and java on the server side and passing as JSON. For this test I am using the code below:
String cssString2 = "[\'cssItalic\']";
CalendarEvent calendarEventDtls = new CalendarEvent(
encoded_pat_id,
result.getString("name"),
result.getString("daysOfWeek"),
result.getString("stt_start_date"),
result.getString("stt_end_date"),
result.getString("stt_start_time"),
result.getString("stt_end_time"),
result.getString("stt_colour"),
cssString2,
encoded_stt_id,
result.getString("icon"));
calendarEventList.add(calendarEventDtls);
Where cssString2 is what ever I am trying to test:
String cssString2 = "[\"cssItalic\"]";
String cssString2 = "[\'cssItalic\']";
String cssString2 = "[cssItalic]";
String cssString2 = "cssItalic";
String cssString2 = "[\'cssItalic\', \'csscssUnderline\']";
Everything else is working as I expect.

Related

How to parse String to MbMessageAssembly? In Java Compute node IIB

I am quite new to this, and I am struggling with one issue.
In Java Compute Node, through IIB, I am checking if one field has one or more values, and for each additional value I am creating a new duplicate message, except for value, these additional values are overriding.
This is working fine as a expect, see example:
Input :...
</leg_flight_no><lineNumber>2</lineNumber><shipper_name>BMW AG</shipper_name> <shipper_reference_hu>1111111;22222222;333333333</shipper_reference_hu></root>
Modified message 1:...
</leg_flight_no><lineNumber>2</lineNumber><shipper_name>BMW AG</shipper_name> <shipper_reference_hu>1111111</shipper_reference_hu></root>
Modified message 2:..
</leg_flight_no><lineNumber>2</lineNumber><shipper_name>BMW AG</shipper_name> <shipper_reference_hu>22222222</shipper_reference_hu></root>
Modified message3 :...
</leg_flight_no><lineNumber>2</lineNumber><shipper_name>BMW AG</shipper_name> <shipper_reference_hu>333333333</shipper_reference_hu></root>
But I am struggling to propagate this message out from the Java Compute node. I understand that I cant propagate messages of type String, so I am trying to parse this as a MbMessageAssemble outAssemble. This is my code:
String newMessage = inData.replace(wholeValues, outData); // replace one value with another
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(inAssembly, outMessage);
copyMessageHeaders(inMessage, outMessage);
MbElement outRoot = outMessage.getRootElement();
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", newMessage.getBytes());
alt.propagate(outAssembly);
But this is propagate an empty message, so the newMessage is not parsed to outAssembly. Can anybody with this experience help me with this?
I figured it out. For future, here is your answer
String newMessage = "this is some test";
MbMessage outMessage=new MbMessage();
outMessage.getRootElement().createElementAsLastChild(MbBLOB.PARSER_NAME).createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", newMessage.getBytes());
MbMessageAssembly outAssembly = new MbMessageAssembly(inAssembly, outMessage);
out.propagate(outAssembly);

How to replace a JSON String with Java?

In my JSON Array inside of its file, it has an array set that goes as follows:
{
"user_interface_fields" : {
"tip_identifier" : {
"uuid": "12345678-1234-1234-1234-123456789112"
}
"insert_time" : "2001-01-01T00:00:00Z"
}
And now I got this file written in java
#Test
public void testExampleMessageToJson() throws Throwable {
log.info("\n\nTesting persist service [message to json]?\n");
//Setup
String rawJson = TestUtils.getResourceMessage("examples/life.json");
String tip_identifier_uuid = "12345678-1234-1234-1234-123456789112";
log.info("Raw Json:\n():", rawJson);
assertTrue(StringUtils.isNotBlank(rawJson));
//Test
JSONObject foundObj = persistService.messageToJson(rawJson);
//Verify
String tip_identifier_time = foundObj.getString("insert_time");
String new_time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Calendar.getInstance().getTime());
foundObj.put(new_time, foundObj).getString("insert_time");\
assertNotNull(foundObj);
String new_uuid = foundObj.getJSONObject("user_interface_fields").getJSONObject("tip_identifier").getString("uuid");
assertEquals(tip_identifier_uuid , new_uuid);
assertEquals(tip_identifier_time, new_time);
log.info("\n\nTesting persist service [message to json] COMPLETE!\n");
}
My goal is to have life.json's time to be nearly identical to our current time (so like if it's 11/11/21 01:30:21.22, insert_time's data should be around 01:30:21.2234 or whatever and at any time i or any other person runs the code it should be a near match..)
But in my failure trace it tells me:
org.junit.ComparisonFailure: expected:<202[0-02-19'T'00:00:]00> but was:<202[1-11T17:46:46+00]00>
I'm thinking that the logging is messed up because expected should be nearly matched as the current time (as stated in my goal). Since messagetoJson gets the current time and inserts it, when my test pulls out the insert_time it should be a couple of milliseconds behind and so I need to validate that it's within a second or ~1000 milliseconds.
But I don't know what the heck I should do or where I should go from here in order to fix that.

Creating a poll system using PircBot

I'm new to Java and I'm trying to create a poll system using PircBot.
So far my code is this:
if (message.startsWith("!poll")) {
String polly = message.substring(6);
String[] vote = polly.split(" ");
String vote1 = vote[0];
String vote2 = vote[1];
}
Which splits the strings so that someone can type !poll "option1 option2" for example and it will be split into vote1 = option1 and vote2 = option2.
I'm kind of lost from here. Am I even heading in the right direction for creating a voting system?
I figure that I'd have a separate statement as follows.
if (message.equalsIgnoreCase("!vote " + option1))
But I'm not sure where to go with that either.

Ingest(Update hash Code) in echoprint servers using JAVA

I am developing an android application using JAVA. All I want is to
record a song and generate its hash(CODE), then query the echoprint server for a match.
If a match is not found, then upload it to the server (ingest) for future references.
I have been able to achieve the first part. Can someone suggest me about the second part in JAVA? (P.S. : I've seen how to do it using python codes - but that won't be helpful in my case.)
Another question, may I achieve the second objective with the global echoprint server? Or, do I need to set up one of my own?
The references I've used are:
http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/
https://github.com/gvsumasl/EchoprintForAndroid
To insert a song into the echoprint server database, all you need to do is call the ingest method. Basically, it is only a HTTP POST request with correct json body. Here is a Scala code (Java would be very similar) that I am using for that:
import EasyJSON.JSON
import EasyJSON.ScalaJSON
import dispatch.Defaults.executor
import dispatch._
class EchoprintAPI {
val API_URL = "http://your.api.server"
def queryURL(code: String) = url(s"$API_URL/query?fp_code=$code")
def query(code: String): scala.concurrent.Future[ScalaJSON] = {
jsonResponse(queryURL(code))
}
def ingest(json: ScalaJSON, trackId: String): scala.concurrent.Future[ScalaJSON] = {
val metadata = json("metadata")
val request = url(s"$API_URL/ingest").POST
.addParameter("fp_code", json("code").toString)
.addParameter("artist", metadata("artist").toString)
.addParameter("release", metadata("release").toString)
.addParameter("track", metadata("title").toString)
.addParameter("codever", metadata("version").toString)
.addParameter("length", metadata("duration").toString)
.addParameter("genre", metadata("genre").toString)
.addParameter("bitrate", metadata("bitrate").toString)
.addParameter("source", metadata("filename").toString)
.addParameter("track_id", trackId)
.addParameter("sample_rate", metadata("sample_rate").toString)
jsonResponse(request)
}
def delete(trackId: String): scala.concurrent.Future[ScalaJSON] = {
jsonResponse(url(s"$API_URL/query?track_id=$trackId").DELETE)
}
protected def jsonResponse(request: dispatch.Req): scala.concurrent.Future[EasyJSON.ScalaJSON] = {
val response = Http(request OK as.String)
for (c <- response) yield JSON.parseJSON(c)
}
}
To generate the fingerprint code, you can use echoprint-codegen command line call or use the Java JNI integration with C lib

How to get test instance details from Test Set in HP QC-OTA Client Java / C#

Actually, I need to retrieve all test instances which is been loaded up in Execution Grid tab from the given TestSet ID using C# or java
Here is my code (JAVA):
ITDConnection tdc = ClassFactory.createTDConnection();
tdc.initConnectionEx(url);
tdc.connectProjectEx(domain, project, username, password);
ITestSetFactory sTestSetFactory = (tdc.testSetFactory()).queryInterface(ITestSetFactory.class);
ITestSet sTestSet = (sTestSetFactory.item(1301)).queryInterface(ITestSet.class);
System.out.println(sTestSet.name());
Using above piece of code I was able to retrieve the name of the TestSet
ITestFactory iTestFactory = sTestSet.tsTestFactory().queryInterface(ITestFactory.class);
Com4jObject oTest = iTestFactory.newList("");
ITest iTest = oTest.queryInterface(ITest.class);
System.out.println(iTest.name());
but when I'm trying to connect TestSet obj to testfactoy I'm unable to achieve it. Am I missing anything? Can anyone help me please?
Thanks

Categories

Resources