Thursday, August 27, 2020

Wonders of MarkLogic Queries

MarkLogic Query needs every correct set of braces to return correct results. 

When using cts.search(cts.AndQuery[query1(), query2()]) using server side javascript - it was not throwing any error or complaining about braces just returning all the documents in the document store.

Talked to Derek@MarkLogic and he was able to quickly spot the error, a curly brace was missing and that did the trick, he said its a bug in MarkLogic and it will be fixed in upcoming releases.

Corrected the query as cts.search(cts.AndQuery([query1(), query2()])) and it worked like a charm.

Lessons learned, if you query is not working as expected, verify your braces as well.


MarkLogic content store Documents vs named store

All documents created under MarkLogic "Documents" store are universally indexed and can be searched without creating any index manually. However documents created in content store created in MarkLogic other than Documents i.e. "my-content-store", documents are not indexed by default. Appropriate type of indexes need to be created for the fields or path for "my-content-store" document store.

Path range indexes are one of the most common index type that is created to use in enterprise applications.

Path range index example1:  "address/state"

Search documents will be based on either of these: field1/address/state or address/state or field1/field2/address/state

Path range index example2:  "/address/state"

Search documents will be based on exact path : /address/state only

Sunday, August 23, 2020

Details of MarkLogic Connector for Kafka

How MarkLogic Kafka connector works and what it entails? 

MarkLogic has provided a connector to consume the messages out of a Kafka topic, calling as SINK process. 

Main Features:

- It's a Java utility and provided with community support, no enterprise support available.

- Connector consumes the messages out of Kafka topic and MarkLogic document names are unique but automatically generated UUIDs and cannot be changed. Although uri prefix and document extension is supported.

Example documents: AABC-WERE-UUID-THIS.json, uri/AABC-WERE-UUID-THIS.json

Had a conversation with MarkLogic original developer and he mentioned that the code can be updated to mend as needed but MarkLogic won't do it.

- Connector consumes the messages in batches periodically which can be configured, how frequently and how many to consume each time.

- It supports 2 Way SSL with candidate application

- It does not support AVRO format as of today and cannot validate the messages based on a schema


Documentation: https://www.marklogic.com/blog/kafka-marklogic-connector/

Github link: https://github.com/marklogic-community/kafka-marklogic-connector

Wednesday, August 19, 2020

How KStream, Ktable and Join works?

There were lot of unknowns or at least I was not knowing how KTable, KStreams and Join between them works or behaves when I started using these artifacts from Apache Kafka.

I would like to mention some of the unknowns that were not documented and we ran into issues because of them:

1. KTable stores the mapping as (key, value) pairs. Whenever there is an update to the key, the entire value object is getting replaced and it is not getting updated.

Example:

Key: A0001

Value: {id:001, name:ABC01}


Please keep visiting, will complete the post.

Thursday, March 30, 2017

Updating producer handle deletes all remote portlet instances

Updating producer handle deletes all remote portlet instances

Platform: WebLogic Portal (Oracle formerly BEA)
Version: 10.3.7 (may be in earlier version too)

Description: When producer handle is updated using Portal Admin Console (with or without checking the Re-register Producer), it deletes all the remote portlets associated with the handle. This has been reported and Oracle has created a bug for this issue.


Solution: There are various ways to avoid deleting the associated remote portlets, when trying to update the remote producer handle:

1. Update the remote producer handle directly in the portal database  table by running the following query:
update PF_CONSUMER_REGISTRY set WSDL_URL = 'http://myNewProducer.com/webApp/producer?wsdl' where PRODUCER_ID = XXXX;

Warning: This seems pretty simple however involves touching the portal database directly, one small mistake and you can corrupt your portal database, so take extreme precaution! Don't forget to commit after you ran the query.

2. Get the patch for the bug from Oracle, here is the detail:
Bug 25227539 : Reregister of ProducerHandle deletes the existing portlets from DVT & PATconsole.
This requires a lot of work, but is safe and will fix the issue. After the patch is applied, producer handle can be updated using portal admin console without checking the re-register handle check box.

PS: If you are following any of the above solutions, please leave your comments.

Find hung transactions in Database

Find hung transactions in Database during two phase commit

Database: Oracle
Version: 11g

When using two phase commit involved in an application feature, to find out the hung transactions in Oracle database following query can be used:
select * from dba_2pc_pending;

This should display the list of hung transactions with all the particular details including the calling client/user and other details.

Monday, December 14, 2015

Remove Zone2 from Sony STR DH820 Receiver

Here is how you can achieve the followings:

  1. Remove Zone2 from Sony STR DH820 Receiver
  2. Reset the receiver remote RM-AAP061


Problem: Somehow someone pressed the zone2 button on remote or receiver and can't go back to zone 1 using remote.

Solution:
Step 1. Turn off all the receivers (zone 1 and zone 2) by pressing (On/Off) and (AV On/Off) same time on the remote pointing to the receiver.

Result: Receiver will be in standby mode for both zone 1 and zone 2.

Reference: Page 67, right column user guide.

Step 2. While holding down (MASTER VOL -) key, press and hold (On/Off) and then press (A/V On/Off) on the remote pointing to the receiver.

Result: The RM SET UP indicator flashes 3 times.

Reference: Page 85, left column user guide.

User guide URL: http://pdf.crse.com/manuals/4266497121.pdf

Thursday, April 2, 2015

Align the contents using af:panelGroupLayout

Want to align the contents using af:panelGroupLayout ?


Use the following code snippet to horizontally right align the contents:

<af:panelGroupLayout id="vinaypgl01" width="400px" layout="horizontal" halign="right">
<af:outputText id="vinayot01"> This line will be right aligned.</af:outputText>
</af:panelGroupLayout>

Use the following code snippet to horizontally center align the contents:

<af:panelGroupLayout id="vinaypgl01" width="400px" layout="horizontal" halign="center">
<af:outputText id="vinayot01"> This line will be center aligned.</af:outputText>
</af:panelGroupLayout>

Wednesday, March 18, 2015

AF:PanelGroupLayout not stretching to its full width

Want to stretch the contents to its full width using af:panelGroupLayout ?


Use the following code snippet to stretch the content to its full width:

<af:panelGroupLayout id="vinaypgl01" width="400px" styleClass="afStretchWidth">
<af:outputText id="vinayot01"> This line will not be wrapped, it will be in full width of the panel grid layout i.e. 400 pixels.</af:outputText>
</af:panelGroupLayout>

Use the following code snippet to arrange the content blocks horizontally:

<af:panelGroupLayout id="vinaypgl01" layout="horizontal">
<af:panelGroupLayout id="vinaypgl02" width="400px" styleClass="afStretchWidth">
<af:outputText id="vinayot01"> This is first block.</af:outputText>
</af:panelGroupLayout >
<af:panelGroupLayout id="vinaypgl03" width="400px" styleClass="afStretchWidth">
<af:outputText id="vinayot01"> This is another block.</af:outputText>
</af:panelGroupLayout>
</af:panelGroupLayout>

Use the following code snippet to arrange the content blocks vertically:

<af:panelGroupLayout id="vinaypgl01" layout="vertical">
<af:panelGroupLayout id="vinaypgl02" width="400px" styleClass="afStretchWidth">
<af:outputText id="vinayot01"> This is first block.</af:outputText>
</af:panelGroupLayout >
<af:panelGroupLayout id="vinaypgl03" width="400px" styleClass="afStretchWidth">
<af:outputText id="vinayot01"> This is another block.</af:outputText>
</af:panelGroupLayout >
</af:panelGroupLayout >

AF:GridCell not stretching to its width

When using the contents are wrapped even after giving the width.


To stretch the component to its full width of the cell use the following snapshot of code:

<af:panelGridLayout id="vinaypgl01" width="400px">
<af:gridRow id="vinaygr01">
<af:gridCell id="vinaygc01" halign="stretch" width="50%">
<af:outputText id="vinayot01"> This line will not be wrapped, it will be in full width of the panel grid layout i.e. 400 pixels.</af:outputText>
</af:gridCell>
</af:gridRow>
</af:panelGridLayout >