OnMouse events 🔥

OnMouse events 🔥

Submitted October 21, 2017 at 01:42PM by Grvpdw92
via reddit http://ift.tt/2gy4y3a


Question about using Golang to send files over TCP.

Question about using Golang to send files over TCP.

To learn and play with the Golang standard library, I'm trying to write something that syncs my documents folder to my VPS. The idea is that I'd have a server listening on my VPS, and then a client task running hourly on my home PC. It'd look for every .txt, .docx, or .xlsx file in my folders, connect to the server, and say "here comes file dog_bio.txt at 48702 bytes. That done? Okay, here comes cat_bio.txt at 32441 bytes." And then once that was working, I'd set up two-way communication, so the client can say "here are the files I have" and the server can say "oh I don't have that one, send that."

I got the absolute basic form down — net.Listen spawning a goroutine for every new request, which uses io.Copy to dump the contents to a file with a hardcoded name, and then net.Dial connecting to that and using io.Copy to read a file and dump it into a net.Conn.

What I'm confused about now is how I could proceed. How would I delineate between the files I'm sending and the filenames/sizes to expect? How would I capture that information on the server side, and what should I look at to enable two-way communication (without going to websockets)? I've read the stdlib documentation, but a lot of it flies over my head or doesn't seem relevant to this specific topic, so I'm a little stumped.

Submitted October 21, 2017 at 12:58PM by JumboJellybean
via reddit http://ift.tt/2ir1MwU

I’d like to use Go for a web app, but my partner only knows python. Is there a way we can both get what we want?

I’d like to use Go for a web app, but my partner only knows python. Is there a way we can both get what we want?

tl;dr: Is it plausible for me and a partner to develop a web app in pyhton and Go?

I mostly take care of the models and views while he does the logic and data analysis/visualization. Our aim is to build a production dashboard with a small collection our charts and raw data tables. I'm fairly new to Go(~1 month of messing around), but not programming. I have a couple years experience with C#, and ~6 months of python.

As far as I can tell, the standard libraries for web dev amount to something reminiscent to python-flask, and the templates aren't too foreign either. This is partly a learning experience for me, and I feel like I have nothing to learn by making another simple flask app that only reads data from a database.

Is there a fairly easy way I can develop an interface for our database in Go, and give him access via python whether it returns json, xml, or whatever?

Edit: I should mention, we're both on windows, and as much as I'd love to use linux, that isn't an option for either of us.

Submitted October 21, 2017 at 10:01AM by kwerkor
via reddit http://ift.tt/2gWxf6B