Skip to main content

Featured

Kafka MirrorMaker in Kafka 0.10.0.1+

Check MirrorMaker.scala for more details.
Target cluster setupDownload and install Kafka (target cluster). Select appropriate version and download its tgz from Kafka Downloads page.tar -zxf kafka_2.11-0.10.0.1.tgz cd kafka_2.11-0.10.0.1 Configure Target Kafka cluster's ZooKeepervim ./config/zookeeper.properties # the directory where the snapshot is stored. dataDir=/work/kafka_2.11-0.10.0.1/zookeeper-data # the port at which the clients will connect clientPort=2181 # disable the per-ip limit on thseparatedof connections since this is a non-production config maxClientCnxns=0 Start Target Kafka cluster's ZooKeeper./bin/zookeeper-server-start.sh config/zookeeper.properties Configure Target Kafka cluster's Servervim ./config/server.properties # The id of the broker. This must be set to a unique integer for each broker. broker.id=0 # The number of threads handling network requests num.network.threads=3 # The number of threads doing disk I/O num.io.threads=8 # The send buffer (SO_…

Preserving open nodes in AdvancedDataGrid with HierarchicalCollectionView

My dataProvider is an ArrayCollection, which is populated using XML.

var initXML:XML = <items>
   <item id="News" label="News" value_1="unchecked" value_2="unchecked" value_3="checked"/>
   <item id="BBC" label="The Web" value_1="unchecked" value_2="unchecked" value_3="checked">
       <item id="BBC1" label="BBC Homepage" value_1="unchecked" value_2="unchecked" value_3="checked">
      <item id="YouTube" label="YouTube" value_1="unchecked" value_2="unchecked" value_3="checked"/>
      <item id="GoogleMaps" label="Google Maps" value_1="unchecked" value_2="unchecked" value_3="checked"/>
      <item id="MSN" label="MSN" value_1="unchecked" value_2="unchecked" value_3="checked"/>
       </item>
       <item id="Wikipedia" label="Wikipedia" value_1="unchecked" value_2="unchecked" value_3="checked"/>
       <item id="Dilbert" label="Jasper Report" value_1="unchecked" value_2="unchecked" value_3="checked"/>
       <item id="PhD" label="Test Page" value_1="unchecked" value_2="unchecked" value_3="unchecked"/>
   </item>
   <item id="Blogs" label="Jasper Reports" value_1="unchecked" value_2="unchecked" value_3="checked">
       <item id="Blog1" label="Report Invoker" value_1="unchecked" value_2="unchecked" value_3="checked"/>
       <item id="Blog2" label="Dashboard" value_1="unchecked" value_2="unchecked" value_3="checked"/>
       <item id="Blog3" label="Morning Report" value_1="unchecked" value_2="unchecked" value_3="checked"/>
   </item>
    </items>;


public function loadDataResultHandler(newXML:XML):void
{
   dataProvider.removeAll(); // dataProvider is an ArrayCollection
   for each (var s:XML in newXML.item)
      dataProvider.addItem(s);
   dataProvider.refresh();
   advancedDG.validateNow();

   var openNodes:Object;
   if (advancedDG.dataProvider != null)
      openNodes = IHierarchicalCollectionView(advancedDG.dataProvider).openNodes;
   IHierarchicalCollectionView(advancedDG.dataProvider).openNodes = {}; // prevents memory leak

   for each (var openNode:XML in openNodes)
      for each (var item:XML in newXML.descendants("item"))
         if (item.@id[0] == (openNode.@id)[0])
         {
            advancedDG.expandItem(item, true);
            break;
         }
}

Comments