My Hive Posts

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

    Using Asynchronous Function when Voting using Steem.js

    December 07, 2017
    using-asynchronous-function-when-voting-using-steem-js

    This tutorial is for solving few issues encountered while using Steem.js. While working on a simple [Discord Upvote Bot](https://github.com/codingdefined/DiscordUpvoteBot) I found out that I am getting a lot of Promise Rejection error as well as WebSocket Error and my bot is crashing every time For Example : ``` UnhandledPromiseRejectionWarning: Unhandled promise rejection(rejection id: 1): Error:Bad Request [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ``` And ``` Unhandled rejection Error: not opened at WebSocket.send (/app/node_modules/ws/lib/WebSocket.js:344:18) at /app/node_modules/steem/lib/api/transports/ws.js:135:19 at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromiseCtx (/app/node_modules/bluebird/js/release/promise.js:606:10) ``` So, to fix the first error **UnhandledPromiseRejectionWarning**, which means is caused by the failed assertion. Since we do not have any control on the inner workings of Steem. The best thing for this is to catch the exception as a promise. So to do that you need to use the Asynchrnous function of the vote i.e. `steem.broadcast.voteAsync()` and then use the catch function to catch any error as shown below ``` steem.broadcast.voteAsync( process.env.STEEMKEY, process.env.STEEMAUTHOR, author, permalink, weightPercentage, function(err, result) { // Inner Workings }).catch(function() { //Error Catching }); ``` After doing this, I does not see any **UnhandledPromiseRejectionWarning**. For Unhandled rejection Error: not opened error we need to add the URL of the steem api by using setOptions, because Steem npm package uses web socket and instead we need to use the Steemit API. ``` steem.api.setOptions({url: 'https://api.steemit.com'}); ``` These are few of the errors encountered and now the Discord Upvote Bot is ready to be used in all the servers.


    Posted on Utopian.io - Rewarding Open Source Contributors

    Colourfulphotography - A Big Christmas Tree

    December 06, 2017
    colourfulphotography-a-big-christmas-tree

    Today I am sharing a picture of a big Christmas tree which is placed in Orion Mall in Bangalore, India. The focus was not that great as my mobile does not have great night photography option. ![IMG_20171205_204718.jpg](https://steemitimages.com/DQmdDboKqc2xJX7vGiftj8bUWzrgBqf6vVfwzCK7FuPRv9f/IMG_20171205_204718.jpg)

    Number of Likes Not Showing in Steepshot Web

    December 06, 2017
    number-of-likes-not-showing-in-steepshot-web

    SteepShot has a Web application along with the Mobile application. Though it is on the alpha phase it is actively being developed. I encountered a bug today while using it, when you load https://alpha.steepshot.io it will show you all the photos, however, some of the photos it is showing 0 likes below the photo but when you click it, it loads a pop up where it shows the number of people liked it. As you can see below, it is showing 0 likes but when I clicked it shows 5 people have liked it. ![ezgif.com-optimize.gif](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512554488/wzkjbiafe6hefglx1qyt.gif) ### Expected Behaviour The expected behaviour that it should show the number of likes below the Photo also. For example it should show 5 instead of 0 under the image. ### Browser Chrome - Latest Version ### Steps to Recreate the Error 1. Open https://alpha.steepshot.io 2. Click on any image having 0 likes. 3. The pop up will open up which shows the number of people liked it


    Posted on Utopian.io - Rewarding Open Source Contributors

    Color Challenge - Monday Red - Old Vehicle

    December 04, 2017
    color-challenge-monday-red-old-vehicle-2017124t2133152z

    For today's color challenge post I will show you an old vehicle which is red in color.


    ![image](https://img.esteem.ws/rjeonuc53g.jpg) ![image](https://img.esteem.ws/35429pp3f7.jpg)
    Camera : Nokia 6

    25 Reputation is Showing 0 in eSteemApp

    December 04, 2017
    25-reputation-is-showing-0-in-esteemapp

    In the eSteemApp, users (example : @livingfree) having 25 reputation is showing as 0. ##### When the user (example : @livingfree) having reputation 25 upvotes you, it shows as 0. ![Screenshot_20171204-131050.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512376882/jc4d3pies5kwqpizlplv.png) ##### The User profile also shows as 0. ![Screenshot_20171204-141004.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512376889/rjagiixju1czsfk7hfye.png) Confirmed with Steemd, where it shows 25 ![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512376961/ukxqxlryujswxov1nnio.png) I think it is a possible bug. ### Expected Behaviour It should show Reputation as 25. ### Device Nokia 6, Android 7


    Posted on Utopian.io - Rewarding Open Source Contributors

    Pink Flowers

    December 03, 2017
    pink-flowers-2017123t212924441z

    This image was taken on my recent visit to Nandi Hills. I was checking Color Challenge posts but I could not find the pink color day. So I thought of adding it in Sunday, and call Sunday as any color day.


    ![image](https://img.esteem.ws/c1hmvczu1t.jpg) ![image](https://img.esteem.ws/u9scwr988f.jpg) ![image](https://img.esteem.ws/l4ke8lsnyx.jpg)
    Camera : Nokia 6

    A White Flower

    December 01, 2017
    a-white-flower-2017121t183015614z

    This image was taken on my recent visit to Nandi Hills. Have I told you that I like taking flower photos. Though I love taking pictures of anything but flowers attracts me a lot.


    ![image](https://img.esteem.ws/080y9lbye3.jpg)
    Camera : Nokia 6

    Color Challenge - Thursday Green - A Park

    November 30, 2017
    color-challenge-thursday-green-a-park-20171130t215027734z

    This image was taken on my recent visit to Nandi Hills. It is one of the best weekend gateway from Bangalore. It is just 60 kms from Bangalore which I went from my bike.


    ![image](https://img.esteem.ws/bifntxd6ov.jpg)
    Camera : Nokia 6

    Followers Count Mismatch in eSteem App

    November 30, 2017
    followers-count-mismatch-in-esteem-app

    When I load my profile in Esteem App, the follower's count is 736 whereas the following count is 582 as shown below. ![Screenshot_20171130-100312.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512016680/q700bhkkj92hjuv3s1cf.png) Whereas when I go to the Follow page the count changes, followers is 743 whereas following is 587 as shown below. ![Screenshot_20171130-100332.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512016687/v9jsku2ysc9kpisdzpmf.png) I guess it is a bug in eSteem App. ### Expected Behaviour The count of followers and following should be consistent in both the places. ### Device Nokia 6, Android 7.1.2


    Posted on Utopian.io - Rewarding Open Source Contributors

    Color Challenge Wednesday Yellow - A Yellow Flower

    November 29, 2017
    color-challenge-wednesday-yellow-a-yellow-flower

    A yellow flower is treat to watch as well as a treat to be captured by your Mobile Camera. In this photo I captured three yellow flower with 2 out of focus and one with focus. ![IMG_20171126_093616.jpg](https://res.cloudinary.com/hpiynhbhq/image/upload/v1511970336/f3leec4di5itukgswqp1.jpg) ### Camera : Nokia 6 ### Follow @codingdefined