How I spent 5 hours trying to make a pressable button

avatar

I've always tried to learn new technologies. It's super cool. I loved Steemconnect, now HiveSigner, and I coded a lot with it, though I never published anything. I tried playing with the condenser and directly with the blockchain. I've made quite a few apps, but I never actually played with one of the coolest, Keychain.

I love keychain. You fill in your name, press a button, and your browser extension fills in the key and broadcasts the transaction. You don't even need to fill in your name if it gets stored. It's what powers peakd.com and it's super flexible.

I wanted to try it out. I wanted to make a "transfer" button. Easy, right? I thought I'd have it finished in a few minutes.

The Vue dream

So I went to Vuejs and I used a project I had already started, put in some Keychain code, a button, and reloaded. Nope. Turns out Keychain injects the code AFTER the page loads, so all my code was useless because it relied on having it at the beginning. It's also not isolated like it pretends to be in the example repo, but instead it's easier to read it from the window global.

And then I had to attach it to the button and listen to the keypress and execute the function. Easy in HTML, but in Vue? It should also be easy! That's the "good thing" about Vue, it's advantage, the thing that makes it sell. Yet I was not able to do it. I spent 1 hour figuring out Keychain, then 2 hours fighting with Vue.

The Bulma helpers

So I went to Bulma. I remembered I had seen a really cool package called bulma-start that came ready to set up a website! But I didn't want to use raw HTML. It's too ugly with all the <></> opening and closing. It's barely readable. The bulma-start package doesn't come with Pug, though, and that's the prettiest HTML template engine and renderer (what Sass is to CSS).

Soooo. Because I knew Keychain is simple, I decided to just go and start including Pug into it. I even published the package because I know I'll be using it a lot. It's a download, install and use kind of scenario without an extensive setup process. The only bad part is that it doesn't come with a server, but the good part is I can just upload the dist folder into any server and it'll work.

The thing itself

For the sake of testing Keychain (opening the html file directly doesn't let Keychain inject the Javascript variable into the Window global), I used a Python server. Which turns out it's also not SimpleHTTPServer like I always used it (python -m SimpleHTTPServer) but now with Python 3 it's python -m http.server. That's my favorite test server: just write it in the console, press enter, and boom, my files statically accessible on port 8000.

The worst part is that the button code is just a couple of lines of code.

<div class="button" onclick="transfer()">transfer button</div>
<script>
const transfer = () => window.hive_keychain.requestTransfer(
  "cryptosharon",
  "lunaticpandora",
  "0.001",
  "Hive_Keychain test on Vuejs",
  "HIVE"
);
</script>

Yep, that's it. I could have written a simple HTML file and tested it, yet decided to spend 5 hours setting up a "coding environment" in order to... I don't know, be a perfectionist. I want to do a full app eventually, someday, and maybe I thought this was going to be it, the start of the start. Maybe it will, but I spent so much of my time making the pre- that I'm not sure when I'll have the time to do the do.



0
0
0.000
23 comments
avatar

Good job! I've actually used Vue for the past few years. Amazing framework! I even used it for the hive.io website: https://gitlab.syncad.com/hive/hive-io

Feel free to check it out and try to run it. It uses another framework on-top called "Nuxt", which gives it an opinionated structure and simplifies/enhances things.

0
0
0.000
avatar

Whenever I saw Nuxt, I thought it was Vuex. That's why I never looked at it, thinking it was just the Vue storage module hahaha. But when you said "which gives it an opinionated structure..." you made me realize that they're different things. I had a world hidden away from me due to a simple name confusion. 😂 I checked their websites and it sounds really interesting. I'll have to try it out.

I'll probably do as you say. I'll download hive.io and run it. It'll be useful to have a pre-populated environment to learn how things work. I think that's the most effective way of learning sometimes: by example. So thank you for the offer and for showing me that. :)

0
0
0.000
avatar

I think that's the most effective way of learning sometimes: by example. So thank you for the offer and for showing me that. :)

Well, that's how I learned. And tbh, I think it's one of the best ways to learn. Ofc you should develop your own style, but using an already functioning structure can be really useful. And after all, much of that structure is opinionated. Some people prefer to have their code in as few files as possible, while others want to create components out of everything. Gotta' find your own way, but give yourself time and enjoy the progress!

0
0
0.000
avatar

I learned Nuxt, then I learned Nextjs, then I got a job in February, and I've been working as a web developer since then for various clients... 😂😂

Thanks? Kdjdjsjdjlslkhjslls

Thanks. 😊

0
0
0.000
avatar

Congratulations! Which do you prefer? Also, do you have some things you developed you can show? 😃

Posted via inji.com

0
0
0.000
avatar

I can show you some on chat since they're privatish projects. (Are you on Telegram?)

Tbh, I've used Nextjs way more because when I had some issues with Nuxt, it was harder to find support, and since I was on a short timeline, I simply jumped ship. This was mostly due to numbers, not personal preference; I just saw there was like 5x+ the userbase on Discord and Github and was being pressured with a few k on the line.

I have since resolved the Nuxt issue I had, but I have way more experience with Nextjs, so if I had to choose, I'd pick Next because I have a few templates ready and more google-fu muscle memory, and could finish a simple site in an hour, but I'd still like to keep learning Nuxt and would work on such a project if the need arose.

0
0
0.000
avatar

Interesting art. What is it for?

0
0
0.000
avatar
avatar

i meant: What's the use of the button you created?
Anyway, How's the lockdown going?

0
0
0.000
avatar

The button is a donation button. Ideally, people will press it and send me money 😂 or they can configure it to send money elsewhere.

Lockdown's locky. Venezuela hasn't been very flexible. I've gone out maybe twice since February and haven't been able to purchase essential items I need for work. I've also earned very little, so life's hard. But I'm pushing through!

How about you? How's lockdown on your side?

0
0
0.000
avatar

Here in Romania we have some interesting measures for stores: mandatory masks, social distancing.
For some stores and banks we also have temperature screening.
People who rule us imposed measures because of a virus.
i have a curiosity:

  • What's the proof for the virus?
0
0
0.000
avatar

What's the proof for the virus?

250+ countries around the world, tens of thousands of doctors in each country, that's tens of millions of doctors. At least a few doctors would have spoken out, no? Statistically, if the virus did not exist, some doctor would have said so, no?

In fact, I reckon that if doctors all around the world were noticing the pattern of "no virus but they tell me to say there is a virus", hell would break loose with all the doctors saying that the virus is a hoax. But so far there is not even one news article about this.

So, I say, it's more likely that the virus does exist.

0
0
0.000
avatar

250+ countries around the world, tens of thousands of doctors in each country, that's tens of millions of doctors.

Somehow they concluded that there is a virus. How did they end up at this conclusion?

0
0
0.000
avatar

By testing... do you think that doctors just create medicine at random, following recipes and never testing their effectivity, just trusting Big Pharma?

There are many laboratories in every country dedicated to the research of diseases. In fact, major universities have disease research centers as well, and there is a whole branch of science called Biomedical Engineering (https://en.wikipedia.org/wiki/Biomedical_engineering).

These laboratories are filled with people dedicated to this field. Many of them are passionate about what they do.

0
0
0.000
avatar

i agree with all you said. My curiosity doesn't refer to the medicine. It refers to the virus.
How did they identify the virus?

0
0
0.000
avatar
(Edited)

Each virus has identifiable traits that make them different from others. When you have people with new symptoms and contagion methods, you know you're dealing with something new, so grab the blood of many people with similar symptoms, you put their blood under a microscope and you can see what they have in common when compared to healthy blood. You also compare it to other viruses.

https://www.sciencealert.com/this-is-what-the-covid-19-virus-looks-like-under-electron-microscopes

https://www.flickr.com/photos/niaid/albums/72157712914621487/with/49531042877/

You don't have to look at it directly, though. When you're dealing with new symptoms, new forms of transmission, etc., you know you're dealing with something new. When a virus infects a person, it also affects the surroundings. You can look at the antibodies, for example, and by examining them, you can notice whether a person has been infected with COVID-19 in the past, even if they are already "cured".

https://www.cdc.gov/coronavirus/2019-ncov/testing/serology-overview.html

There are petabytes of reference information against which these samples can be compared. Everything from chemicals, antibodies, previous vaccines and drugs... you can apply many tests and arrive to conclusions about the nature of a disease (viral, bacterial, etc.), the origin, etc.

0
0
0.000
avatar

The testing procedures they use are not designed to identify a virus.


What do you think about that?

0
0
0.000
avatar
(Edited)

What do you think about that?

I'm not a biologist lol. (I also don't think you are, though you could prove me wrong) Anything we say is just talk.

However, I will indulge you and analyze the video because why not.

The video you show has some potential issues, mostly argumentative. I'm a writer, not a biologist, so the arguments are the only thing I can talk about. Let's go point by point:

1. He cherry-picks whatever he wants in his first piece of evidence. Read the full text:

He grabs the "more distant" one. It had already been said before in the paragraph that it was 88% similar to another SARS virus, etc. And he grabs the 79% out of the blue and says that this number is evidence that the virus was too dissimilar to establish an identity. But that's not the only piece of data, obviously, as can be seen by the rest of the text, so what he says has no value here.

imagen.png

He goes on to clarify that this is too much of a difference because if we compare humans and chimpanzees we're very dissimilar but have around 96% DNA similarity. This is a fallacy because it says "if x is true, then y must also be true", but that is a false association. Humans are extremely similar to chimpanzees, in the sense that we're not only mammals but also have four extremities with 5 fingers each, eyes in the same place, blabla, and they're in the same family line. So when he says that 96% is too dissimilar, he's not saying anything valuable because that's an outright lie, and even then, that is the X in "if x is true then y is true", but in this case, Y has nothing to do with X. It's a discussion about viruses, not primates. So even if chimpanzees were as dissimilar as he claims to humans, this fact has no repercussion on a conclusion about the identity of a virus.

2. He doesn't show any evidence about his claims that the people who made the studies were irresponsible

He only showed one case, and even then he pointed at some things and said that these things proved that everything that had been done was for naught. Since he shows absolutely no evidence and doesn't back up his claims except with a picture, it's basically his word against their word. That is simply not the way trustworthy research is published. If you really want to find evidence, look for published research.

3. He makes claims about the disease without any evidence, where the existing evidence points to the opposite side

In the last part, he says "if you look more broadly at the data of mortality, and such, you'll see that there is no evidence of a new disease either". This is simply wrong. First, all doctors all around the world agree that this is called COVID-19, so whether this virus can also be called ASDOASD-123 is irrelevant.

Why? Because what matters are three things: (1) what the symptoms and consequences are for the person, (2) how to treat it and (3) how to make people invulnerable to it. If you have people with new symptoms and there is a pandemic, then you know that there is something that humans are not prepared for.

If you understand antibodies and immunity, you know that people can become immune to a virus, and that these viruses that people are immune to are not the ones that make rounds killing people (simply, because people are immune to them). Therefore, if there is a virus making rounds and killing people, it's clear that it's something new against which people are not prepared.

If you see that the symptoms are uncommon but shared among all the people who have the same disease, you know that these people have gotten sick, and you know that what they have is not what was there before in the ecosystem. You can make note about the symptoms and the consequences so that you can treat people better and protect the most vulnerable people (those with asthma, weak lungs, lung cancer, etc.)

Once you test the virus, whether it's called COVID-19 or ASDOASD-123, if you can create appropriate reactions in the antibodies so that they start rejecting the virus, or reacting to it in a way that diminishes the harm to the individual, you are succeeding, regardless of whether the virus is new or not (though we've already established that if no one is immune to it, then it has to be something that they haven't been infected with before, so either really new, really old or really foreign).

Then the objective is simply to make people immune to it. If a researcher manages to create a treatment that makes a person's immune system not-infectable by the disease, isn't that a success regardless of whether the virus was called COVID-19 or ASDOASD-123?

So, when this dude, Dr. Andrew Kaufman, says that "if you look more broadly at the data of mortality, and such, you'll see that there is no evidence of a new disease either", he is speaking nonsense, because the medical consensus is that there IS evidence of new symptoms in a disease that is making rounds killing people. He shows absolutely nothing that disproves this in any way.

Additionally, I already showed you pictures of the virus, so it has been isolated. This video is from 2 months ago. That's a long time for a research field that moves forward so fast.

So, while he may have been right or wrong, this video says nothing about whether what he says is reliable. He makes so many argumentative mistakes that any effort he may have made is rendered useless.

edit: as I said above, I'm not a biologist, or a scientist, or in any way an activist regarding Covid. So I have absolutely no idea why you're showing me this, and debating with me. I'm not interested in the topic. The only reason I'm responding to you is because you're on my comments section and I can't just leave you hanging, but if you want someone who's really intimate with the topic, find a doctor, a nurse, a biologist, a scientist of some sort. You have #steemstem. Why come to the blog of a random Venezuelan writer and start debating about whether Covid exists or not? Lol. It makes no sense to me.

Instead of talking about biological research with a linguist, why don't you talk about it with a biologist? There are plenty of research centers. I'm sure your country must have some. Contact them! I'm sure there are many public forums where you can engage with people from the area who will give you more reliable information about the virus.

edit2: and stay way from pseudoscientific forums. There are plenty, but they'll only give you partial unpublished and untested information. If you want reliable information, you have to go to specialists who actually know about the topic.

0
0
0.000
avatar

Additionally, I already showed you pictures of the virus, so it has been isolated.

We all have viruses in our body, so in what way is a picture of a virus relevant?

i asked you what's the proof because something doesn't add up: last year we didn't wear masks and so far

  • nobody proved that this year virus is different than last year.
  • nobody proved that the mortality rate for this year's flu is different than last year.
  • nobody established a causation between people who died and a virus that's so dangerous that we have to wear masks, because the testing procedures they use are not designed for diagnostic.

Without a proof a theory is just a speculation, pseudoscience.
Do you believe a theory without proof or do you need a proof?
Without a proof why are we losing our freedom?

0
0
0.000
avatar

i appreciate your efforts ♥. well it is difficult to concentrate in one thing even for 1 hour for me. :p keep it up !

0
0
0.000