Need help talking to WhatsMiners using Python - python

For a project I am trying to communicate with an ASIC bitcoin mining machine, specifically a WhatsMiner using Python.
There is a pretty decent guide online that outlays the basic structure of how to do this, and the commands it shows work great on my miner.
However, what I am wanting to do is be able to set both the 'power percent', as well as the 'target frequency' of the machine.
The json format of how these are to be written is outlined in their API documentation which I have included screenshots of.
Throughout university, I haven't touched much json, so am having some trouble with this. To give you an idea of what I am doing, I have followed the GitHub guide above and changed the 'cmd' parameter to either "set_power_pct", or "set_target_freq". I then have changed the 'additional paramaters' to the corrosponding values outlined in the API guide.
Sorry if I am just making a dumb mistake, I really appreciate anyone's help!
Thanks
Beyond this, I have spent a bit of time search google, as well as tested this while connected to the miner. The code is not throwing up any errors, but just isn't changing how the miner is running. As I had alluded to, when I try simple commands to turn the miner on or off, this works fine.

Related

Deploy a connection between two platforms' APIs

I know this is not exactly the right type of questions for Stack overflow but I am struggling here and I would greatly appreciate your opinion(suggestions/advices) on the matter.
I am working on an script that works with APIs of two different websites (or even platforms). I have almost developed what I need but as calls to the APIs and information processing.
What my question is, how can I deploy this application online so that it works constantly without me having to keep my computer turned on so that it runs on it? In other words, where can I deploy this app on a server maybe and have it running all the time ? I know it is possible but I really cannot find quality information myself. So if you can either point me a direction or provide links, give advices, that would make my life a bit easier in finishing this project of mine.
Thank you a lot in advance!

VBA API in Python

I bought some API for VBA Excel/reference. Is is possible to use this API in Python 2.x ? Maybe the question could be is there possible to import VBA reference into Python. This is just the idea. Do not have a any clue if this is even possible ? If it is not possible, is there some nice solution ? Do you have some some experience ? Thanks
I think basically you want to translate the VBA to python.
If you can take a look at how the API was constructed then it is possible but you have to translate the code by yourself.
If you can not, then you could build python scripts for your own, base on the logic you figure out, and you have to know about actuarial software you mentioned, if they have API to extract data, or any other means so you can get the data to process (this is possible since the API in VBA could do that)
I have experienced in finance banking, VBA and python in working with finance data, and I'm somewhat familiar with API for accounting software, so if you want you can contact me to discuss so I can help. I think wrap this up in an answer is impossible.
I know that this is from years ago, but I just stumbled across it and thought I would share my 2 cents.
One possibility is to translate it into VBScript - this is very similiar to VBA, and does not require Excel, etc in order to run. It would, of course, depend on what was in the original function.

How to test a Django app

I´m quite new at python/django development and I would like to know what's the best way to test these kinds of applications. I've been doing a little research and I found libraries like magicmock or minimock but I don't really have any idea if they're good or bad or what are the best practices for Django. Can anyone give me some tips? The project I'm working on it's this one https://github.com/Smart-Studio/fbclm-backend/tree/develop , just in case someone wants to take a look a it.
Thanks!
The Official Django Tutorial touches on testing in chapter 5.
The book Test-Driven Development with Python by Harry Percival (O’Reilly) is available free online. It is a tutorial on building a Django project with complete, comprehensive testing. Be warned, it is very slow paced, sometimes frustrating. The author is dead serious about testing every little thing, and he knows his stuff. There is much to be learned from him.
Edit: Some of the remarks above are not fair. I was about a third of the way through Percival's book when I gave this answer. The author's style of teaching is not slow. The pace is comfortable. The author does lead the reader to type some code only to replace it later, but this does help to understand how the process being tested actually works. For someone who is unfamiliar with TDD, the building process can feel painfully slow. You can write several lines of testing code for every single line of application code, before even writing any of the application code. The author doesn't test "every little thing". He gives the reader guidelines to help decide what does and doesn't need to be tested, and there are several things that need to be tested if you really want good coverage.
I apologize for taking this out of the Stackoverflow context for answers. In this case, the crime had already been committed and this edit was required to fix the bug in my answer.

How to properly set up this Sage Cell Server?

I have a question regarding the Sage Cell Server. It is a relatively general question, I don't have any code that I need fixed.
I am trying to set up a server but I am finding the world of servers confusing. I've worked plenty with Java and JavaScript, HTML and CSS on frontend stuff, but for the backend Sage server I decided to develop I figured Python was a good choice. Some basic Lynda tutorials and a book later, I have a pretty good idea how python works... But am still lost. My question is basically this:
-I am trying to design a very simple server running an instance of Sage. I want to be able to SEND Sage code to it (NOT PYTHON) and have it evaluated and the result sent back, as if I were running sage on my own computer. Example: Sending "integrate(x,x)" to the server would return 1/2*x^2
-What is the best way to go about doing this? Should I download the Sage Cell Server?
-Will I need to even write Python code for this? How long would this task take in hours?
-Would it be easier for me to design the server to receive and execute Python code instead of Sage code? How would I go about doing this?
If you are wondering why I want to do this, I want to design a website where people can type in their math problems and have them evaluated by sage. I know there are simpler ways to do this but I've wanted to do server-side work and get people talking with a server for a while now and this seems like a good introduction to it.
Any and all advice is appreciated, resources, help, etc.
There are certainly a number of people who have successfully set up their own Sage cell server, and as such things go I hear it is definitely doable. The previous "simple server" API is pretty much defunct and the Sage cell is a pretty reasonable way to do this. I don't see why you would need to have reinvent the wheel here, and asking on sage-support#googlegroups.com is a logical next step for you.

Online Pair Programming with Python

I'm working with a team mate solving some programming challenges online
I was wondering if there was something like piratepad but for python
Ideally it would allow us to collaborate on the same script online, see what the other is editing, chat, and also run it.
Any idea if there's something like that available for python programming? (js would also come handy)
I've found this which seems pretty great, but it doesn't seem to support multiple people working on the same code
cloud9 (https://c9.io) seems to work for that, but I never tried.
I know it is an old question but I stumbled uponit.

Categories