My Hive Posts

    Written by Coding Defined who lives and works in India building useful things. You should follow him on Twitter

    Indexing Documents in SOLR

    December 26, 2017
    indexing-documents-in-solr

    Solr is an Open-Source Search Platform built on Lucene which makes searching fairly easy. In this tutorial we will see how we can Index documents in SOLR. Indexing means adding content to the SOLR index which can be easily searchable.

    ![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1514267235/mwyyhcpqfamqpiptwc9u.png)
    PC : Wikipedia The advantage of using SOLR is that, it can accept the data from any sources be it JSON file, XML or even database. Whatever be the source of data, one thing is common among them is how to fed the data to the SOLR which is nothing but as a document. A document contains multiple fields having name and content. Since I mainly work with Rational Database, I use DataImportHandler for getting the data out of the database. The main steps to follow while indexing the documents are 1. Read the data 2. Create SOLR documents 3. Differentiate between Full and Partial Update (Inserting and Updating). #### DataImportHandler Now the next step is to configure the DataImportHandler in the SOLRConfig.xml file and you need to provide the location of data-config file which has the code to fetch the data, read the data and process the data to create SOLR document. ``` pathtoconfigfile.xml ``` The Sample Data-Config File looks like below : ``` //the entity which you would like to import ``` The commands used by DataImportHandler are : 1. **Abort** - To abort indexing the documents. 2. **Full-Import** - It will import all the documents from the database. Note that querying is not blocked while full-import is going on. Full import usually takes some time depending on the number of documents. 3. **Delta-Import** - It imports only the new documents or any changes happened to the previous documents. 4. **Status** - Shows the number of documents created, updated or deleted.

    Posted on Utopian.io - Rewarding Open Source Contributors

    Seven Days of Black and White Challenge - Day 1

    December 25, 2017
    seven-days-of-black-and-white-challenge-day-1

    I was nominated for the Seven Days Black and White Challenge by @geetharao Mam. So the rules of the challenge is - 1 - Take 7 black and white photos, that represent the aspect of your life. 2 - Present one image everyday for seven days.. 3 - No People. 4 - No explanation.. 5 - Nominate someone everyday, although anyone can join in. 6 - Use the tag # sevendaybnwphotochallenge as one of your five tags. 7 - Adding a title is optional. Day 1 : ![IMG_20171225_205609_2.jpg](https://steemitimages.com/DQmRqdUmBZWL7uFqhCKaky7Ut1uqnAcuux29ks1Qm3kC2TD/IMG_20171225_205609_2.jpg) I would like to nominate @manishmike10, as because he also loves to take mobile photos and he runs SmartPhone photography contests too.

    Musical Fountain in Bangalore

    December 24, 2017
    musical-fountain-in-bangalore

    Today I have visited to watch Musical Fountain at Jai Prakash Narayan Park (J.P. Park) in Matthikere, Bangalore, India. Its a great experience where you can see the blend of technology and uniqueness. The lightnings also are great and because of the Christmas, a lot of crowd also came to see it. All images are taken from the SmartPhone Camera. ![IMG_20171209_194434.jpg](https://steemitimages.com/DQmTqpGTo1ecj4wXb7QRJC74Pj3s4CYYdx7Jd3EBpvD8bYi/IMG_20171209_194434.jpg)


    ![IMG_20171209_194438.jpg](https://steemitimages.com/DQmXq4weaKZfpo2i42QBh464uPfrY2AvzewFxjim6CgKd43/IMG_20171209_194438.jpg)
    ![IMG_20171209_194445.jpg](https://steemitimages.com/DQmdCE6fdaEwz7NYx4suSpPNi6MstxPcitB8o36Sax8jhSR/IMG_20171209_194445.jpg)
    ![IMG_20171209_194454.jpg](https://steemitimages.com/DQmbk55nge3tH69RdhXVLTbswTinTc61jSto2WwucGCqRDX/IMG_20171209_194454.jpg)
    ![IMG_20171209_194510.jpg](https://steemitimages.com/DQmNipcwp97Ew9Unp4G9SwJpPk48eDjT3VgsY2iVhRhMwtW/IMG_20171209_194510.jpg)
    ![IMG_20171209_195143.jpg](https://steemitimages.com/DQmTSXPkDiKu32puNHUzaCGiHNrbnJxPeX8Vpp15eayrjvC/IMG_20171209_195143.jpg)
    ![IMG_20171209_195147.jpg](https://steemitimages.com/DQmUtMESKFyTZxQqdxUvJvswyJwoPxJb1vzV1tckfCC7oEu/IMG_20171209_195147.jpg)
    ![IMG_20171209_195253.jpg](https://steemitimages.com/DQmNZW6zKiTt4vSAW88f3oZchXEQHnKMrbbmtb7XmwJhsbz/IMG_20171209_195253.jpg)
    ![IMG_20171209_195257.jpg](https://steemitimages.com/DQmV9gYLsszVEfzx1mMD1AF5e5uzjBRwWGRtdB42FBJA5of/IMG_20171209_195257.jpg)
    ### Camera : Nokia 6

    Master Slave Replication in Solr

    December 23, 2017
    master-slave-replication-in-solr

    We use SOLR a lot for searching. Now to reduce the workload of system we do replication as a Master and Slave where the complete copy of a master is copied over to one or more slave. The intention of using Master-Slave Configuration is that we want one system to completely do the indexing i.e. if any new documents comes in it will be added by the Master and once done slave will show it to the User by getting the updated list from the master. All queries or the result are handled by the slaves. To start with the Master-Slave Replication you need atleast 2 system where one acts as a master and one as a slave. You can have more than one slave too, which all the slaves will act as a query processing server. The configuration of the server is rather simple where you need to add the replication request handler as shown below in solrconfig.js. ``` true commit schema.xml,stopwords.txt,elevate.xml 00:00:20 optimize false MASTER_URL/replication 00:00:60 internal 5000 10000 ``` If it is a master make `` true and when it is slave it should be true. We want the replication should be done after all the files are indexed that's why it is replication after commit. In the confFiles you need to write what all the files which you want to replicate. Here we are keeping schema.xml,stopwords.txt and elevate.xml. In the slave we have to say which is the Master URL and what is the poll interval of finding the new documents from the master. That way you can create Master-Slave configuration and thus the load is balanced between two system and not one.


    Posted on Utopian.io - Rewarding Open Source Contributors

    Color Challenge - Thursday Green - Leafs and Flowers

    December 21, 2017
    color-challenge-thursday-green-leafs-and-flowers

    My today's post about the Color Challenge is flowers and leafs. They compliment each other so well that one would not look good without other. Have you seen any flower which looks good without the leafs or the other way round. ![IMG_20171126_130525.jpg](https://steemitimages.com/DQmWsr2ot9PvQTLybkXEj3EXTzyGj2qEP9NxyUBtE7vTEBy/IMG_20171126_130525.jpg) ![IMG_20171126_124605.jpg](https://steemitimages.com/DQmSJXR8JKYyw6bFG4Zby82aPy1fssQ7TXb9pReHPR7qNiU/IMG_20171126_124605.jpg)

    Send Message to Discord using Discordie NPM Package

    December 20, 2017
    send-message-to-discord-using-discordie-npm-package

    I mainly use Discordie NPM Package for developing Discord Bot mainly because its easy to use and it has a good documentation which is better for any newbie like me to understand the basics. To Start using it, at first you need to install it using the command shown below : `npm install discordie --save-dev` Then you need to require it in your file as shown below, where client is the new object created and Events are all the events which will be fire from the Discord. `const Discordie = require('discordie');` `const client = new Discordie();` `const Events = Discordie.Events;` Next is to start the connection for which you need to first get the Discord Bot Token ``` client.connect({ token: 'Your_Token' }); client.Dispatcher.on(Events.GATEWAY_READY, e => { console.log('Connected as: ' + client.User.username); }); ``` Once you are ready with the connection you need to listen to all the incoming messages and then if any message matches you need to send back the response as shown below ``` client.Dispatcher.on("MESSAGE_CREATE", e => { console.log("new message arrived "); if (e.message.content === "ping") e.message.channel.sendMessage("pong"); }); ``` If you want to send the Typing before sending a message then use below command `event.message.channel.sendTyping();` The main challenge I faced when I tried to upload any document which can be done using the below commands, where first I get the source of the Image and then upload that using uploadFile function. ``` const source = fs.createReadStream('abc.jpeg'); event.message.channel.uploadFile(source, coin + 'abc.jpeg'); ``` Please let me know if you need any more information about the same.


    Posted on Utopian.io - Rewarding Open Source Contributors

    I Contribute to Open Source Projects via Utopian.io and You Should too

    December 20, 2017
    i-contribute-to-open-source-projects-via-utopian-io-and-you-should-too

    ##### I have been contributing to Open Source projects be it @utopian-io, @busy, @steepshot, @eSteemApp etc via Utopian.io from the last 2 months and I want you to start too.


    Its not only for coders or programmers, its for all i.e. any one can contribute to Open Source projects. If you know any language you can translate, if you find any problem (we call it as a bug) you can submit bug report, if you have any suggestion you can write a suggestion. The categories which you can contribute too are shown below, and the Rules can be found [here](https://utopian.io/rules). ![](https://steemitimages.com/DQmZJuHRKMms2wubwranoiKS3mvscjy87pnkjpMQ2EVeNM7/image.png) PC : https://utopian.io At the time of writing this post, Utopian.io already crossed 6600 contributions in less than 3 months of existence, that means its growing and you should grow along with it. ![](https://steemitimages.com/DQmQKH1KsfFJMKS1tjP2ZCmKN8uqVM9KuHP8r6w4F1qkmHH/image.png) PC : https://api.utopian.io The analysis also shows that its growing. From Alexa you can see that in three months the website rank rose to 230,130 World Wide and maximum visits came from USA. My country (India) too is not that far behind and its on the fifth position. Still the search visit is just 5.30% and I know it will increase in future when the SEO will be targetted. ![](https://steemitimages.com/DQmadg6ZPrCyaPPhPwbihqAKdBo3AD7tieGaTzDcMuRWRJG/image.png) From : https://www.alexa.com/siteinfo/utopian.io The below is the full summary of Utopian.io from SimilarWeb where you can see detailed info about Utopian.io.
    ![](https://steemitimages.com/DQmU4LNbJ25kV6FhFvGsnrH7yuvpcv19WcVJpuWgUBNU4DQ/image.png)
    FROM : https://www.similarweb.com/website/utopian.io

    Color Challenge - Tuesday Orange - Sunset

    December 19, 2017
    color-challenge-tuesday-orange-sunset

    My today's entry for color-challenge is a orange sky at the time of sunset. I have tried to capture with two angles one taking half sky and half trees whereas other taking 75% of sky. ![IMG_20171219_174434.jpg](https://steemitimages.com/DQmRguBa3bxKbSwrvrL3fgdnTZqYsrL18icRVTpwGqFbGuJ/IMG_20171219_174434.jpg) ![IMG_20171219_174441.jpg](https://steemitimages.com/DQmUPXLf8bJJp9D2rbFvrJ7LiWxNorCu3Vag6DY8UKAXCwV/IMG_20171219_174441.jpg) Camera : Nokia 6

    Color Challenge - Monday Red - Red Flowers

    December 18, 2017
    color-challenge-monday-red-red-flowers

    My today's entry for color-challenge is a red flower. Its actually not fully red but a mixture of red and yellow. ![IMG_20171105_103134.jpg](https://steemitimages.com/DQmPmdgtqYv2gwFWs5yzMKZAbo61J2Ag7CCkMm5JRakzH2S/IMG_20171105_103134.jpg) ![IMG_20171105_103307.jpg](https://steemitimages.com/DQmeShhgKJgBLhYrXv66HmvqSMwMn3LWsqKERmoRYHWmt2E/IMG_20171105_103307.jpg) ![IMG_20171105_103318.jpg](https://steemitimages.com/DQmTU5MaQ8SWxwgd6y2c4MoQphrCzBXfrgH3xXYvXmf6SEB/IMG_20171105_103318.jpg) Camera : Nokia 6