New to Nutbox?

Programming Diary #1: The Programming Environment, Steem Links, and SteemJ

16 comments

remlaps
75
3 years agoSteemit6 min read

For some reason, I was motivated to spend my days off from work on some Steem programming. Here's what I did with my time off this week.


Introduction

image.png

Pixabay license: source

The thing I hate about programming is choosing the environment. What language, editor,and compiler do I want to use? Basically, I'm lazy, so I just want to turn it on and get going.

Unfortunately, modern programming usually doesn't work that way. The languages with the lowest barriers to entry for me are Python and shell languages like bash, ksh, and zsh, and for those languages, I still write code in "vi". This week, however, my goal was to create an interface for SteemLinks. That goal requires a GUI, and I have no experience (i.e. zero) in that arena.

So my work this week involved choosing a language, choosing a programming environment, learning how to make graphical forms, and learning how to interface with the Steem blockchain (in that language). After I gained that basic familiarity, I moved on to actually creating a semi-functional form for creating HTML/Markdown code for the Steem Links community.

Here are some of the highlights!

Choosing a Programming Language

Basically, my arbitrary starting choices were java, Python, or shell scripting. The experimental @penny4thoughts application is done mostly in shell scripting, and my voting bots are done in Python. It had been 15+ years since I had done anything in Java - and even then I hadn't done much, so that would have been almost like starting from scratch. Also, as noted above, I've never done much of anything with graphics in any language.

I was able to rule out shell scripting quickly, even though that's what I know best. Unfortunately, it's not really suitable if I want to create a graphical user interface (GUI).

At first, I was leaning toward Python, but I wanted to read about how to do GUI development in Python and Java. After reading about that, I decided that java would be better because it can also be useful with development for mobile devices. So.... Java it was.

I want to avoid licensing headaches, so I'm making use of openjdk17

The Programming Environment

I already had Eclipse installed on my PC, so that was the early front-runner. But...

After several hours of updating to the latest version, watching tutorial videos, and otherwise playing around, I still couldn't see a path to creating a GUI in Eclipse, so I bailed out on that and tried Netbeans instead. In contrast to Eclipse, I was able to find a GUI form designer in a matter of minutes in Netbeans, so that's the solution that I settled on.

I also looked, briefly, at IntelliJ, but I didn't see a compelling reason to burn time on it. Maybe I'll take another look at it in the future.

The goal with the GUI is to streamline the process of creating a post in the Steem Links community. To that end, step 1 is to create a form where data can be entered and converted into markdown; step 2 is to auto-populate some of the information from the web; and step 3 is to enable posting it on the Stem blockchain. At this point, I've completed basic versions of steps 1 & 2.

Form Creation

Form design with Java/Swing in Netbeans is fairly easy -- a lot of it is just "drag and drop". So, I had a rudimentary form created in a matter of minutes and spent some additional time expanding it. Here's what the form looks like now.

image.png

Autopopulating the form and generating HTML/Markdown

In order to autopopulate the form, I was thinking that I would use the Open Graph information from the web site, so the user (ME) can simply paste a URL and get some of the other fields automatically. Here's what the form looks like when that's working. (I entered the URL and clicked the "AutoPopulate" button. The other fields were pulled from the web site.)

image.png

To do this, I used the jSoup libraries. I chose this because @cmp2020 mentioned that he had used "Beautiful Soup" for web scraping with Python. I am assuming (based on the "Soup" part) that the two are related.

Once the autopopulation is done, there are some other fields to be filled out by the Steem Linker. These include the date the article was published, an excerpt from the article, and additional author commentary. After filling out the form, the user can autogenerate HTML/Markdown code to create an attractive looking post. After generating markdown, the form looks like this:

image.png

Interacting with Steem

Next up is to actually post the auto-generated HTML/Markdown onto the Steem blockchain, and I haven't made it this far. Right now, a person using this form would have to copy/paste from the output window into a Steem post. Here's a Sample Post after copy/paste from the java app into a Steemit post in the browser.

In order to connect the form to the blockchain, I'm planning to use the @steemj libraries from @dez1337. So far, I have downloaded this from the github site, updated it to use to the latest versions of log4j and slf4j and created a couple of rudimentary input operations to verify that I can connect to the blockchain.

Now here's the part where I call for help. This code has not been heavily maintained in the last couple years, so if there are any Java developers reading this, let's work together and get it up to date! Not sure if we'll need to fork it or if @dez1337 is still around to respond to pull requests.

Conclusion

So that's my progress this week. It's back to work after the holiday, so I don't know how soon I'll be moving forward again, but it has been a good learning experience. Hopefully, I can find some time to move forward slowly and surely.

If there are any java developers who are interested in modernizing SteemJ, I'd be willing to set up a SteemJ community on Steem where we can collaborate on the effort. It would be good to get some other community moderators, too! As they say, "Many hands make light work." Who's in?


Thank you for your time and attention.

As a general rule, I up-vote comments that demonstrate "proof of reading".




Steve Palmer is an IT professional with three decades of professional experience in data communications and information systems. He holds a bachelor's degree in mathematics, a master's degree in computer science, and a master's degree in information systems and technology management. He has been awarded 3 US patents.

Comments

Sort byBest