#this why i only code python bc wtf is this !!!!
Explore tagged Tumblr posts
jellyluchi · 1 year ago
Text
one block of javascript code and I want to d word that guy si really nice to put up with me bc i got no clue what's going on in this script HELLO 😭😭😭😭
6 notes · View notes
pinkfairygsocdailylogs · 4 years ago
Text
GSoC logs (June 5 –July 11)
July 5
DS Exam - 9:30AM.
Alternatives - If build not fixed by 8:30AM.
Reclone and commit all changes to new branch.
Get preview component done
Send the demo to mentors and then touch proto file.
Recloned. In the new clone, I made new changes. Everything works.
Turns out any write operation in the proto file is wrecking stuff. I navigated to the proto file in vscode and simply saved. This causes all the errors again.
Some import errors even though proto syntax are perfectly fine. Hmmm. protoc-gen-go: program not found or is not executable
I tried making the proto file executable with chmod +x. Still same issue. Hmmm.
That was stupid. Proto files aren’t supposed to be executable! -_- Where do I get these stupid ideas.
The error is actually referring to protoc-gen-go file. Saying that protoc-gen-go is not found or not executable. Not the proto file
I’m moving on to completing the preview component to send the demo before 7pm.
Preview component
Ipynb html. Axios get and render the htmlstring from response data in the iframe. Nop, v-html.
Serve html file from the http server for now.Wait, that's not possible.
Okay, maybe I should just use hello api for now. Since both request and response objects have string type properties.
This is embarrassing.
Okay, whatever.
Just fix this and look into it,
Okay, so I can’t represent an html string just like that as in python. With `` ..
Okay `` will do.
I’m starting to like golang. It looks ridiculous but also easy to understand? What’s going on?
July 6
Leads & Tries.
Try Samuel’s suggestion -
“Do you have protoc on your path?
sometimes VScode installs its own version of some tools on a custom $PATH - it could as well be that some extension is not properly initialized “
Interesting - I tried git diff on the proto file and this happens just by vscode saving it.
old mode 100644 new mode 100755
https://unix.stackexchange.com/a/450488
Changed back to 0644 and still the same issue in vscode.
Stupid girl, you just made the protofile executable yesterday and forgot to change it back. -_-
Read about makefile. Do as said. Annotations.proto forward slash path. ?? wtf?
Set gopath right! Permanently. !!! Okay, done. No need to set it everytime now. Hopefully.
Desperate attempts -
Edit proto file in atom. (Prepare to reclone ;_;)
Trying the same in vim ()
Text editor.
Okay, so nothing editor or ide specific.
Trying to change paths
Gopath was /home/anaswaratrajan/go .. changed it to /usr/local/go/bin
New error.
GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go github.com/golang/protobuf (download) package github.com/golang/protobuf/protoc-gen-go: mkdir /usr/local/go/bin/src: permission denied make: *** [Makefile:164: /usr/local/go/bin/bin/protoc-gen-go] Error 1
https://github.com/golang/go/issues/27187
sudo chown -R $USER: $HOME
Doesn’t feel right. But I just want this to get done. ;_;
The problem could be that I have multiple go distributions. After this is done, I need to clean this shit this weekend.
Okay, done chown. I own this shit!!! AAAa
Still permission denied! Shit. /usr/local/go not /usr/local/go/bin
Okay, changed it, but go env GOPATH echoing giving warning that GOROOT and GOPATH are same.
So from what I’ve read, gopath is the workspace, and goroot is the place where go is installed. Our makefile is trying to install and use the modules in GOPATH. Ie go dir in home. Okay, so my GOPATH was right before.
Final tries
* Follow the error trails. * Find out what exactly is happening when I save this file. 1. Okay, incase they don’t work out. Try to send the html string instead of “Hello ” string without changing proto file. 2. Since all ipynb files can have same css, try and send only the html elements. And do the css separately in frontend. 3. Stop Ctrl+Saving for no reason! Great, now I have to reclone ;_; and start over. 4. Okay, I was able to send a sample html string with the response. Without changin the proto file. 5. Here’s what I’m gonna do. 6. Send sample html string from hello service and render in the preview component. Pass the json string as name. Hahaha. Please, explain why you had to do the same. 7. I did exactly as above. I feel like an imposter now. Screw it. 8. Alright, I have my bigbang hyungs to support me. 9. I’m gonna embed python scripts by tonight. Update: that was overoptimistic. 10. So I have the nbconvert python script to generate basic html strings. 11. I should also remove those comments in the html. 12. So we’re using the less performance option since we don’t need much memory in the first place. Using python c api.
July 7
Learned one or 2 things about embedding python. https://github.com/ardanlabs/python-go/tree/master/py-in-mem
So I need python3.7. Bc go-python3 only supports python3.7. But there’s a workaround given. So I should try that
Tries
Go-python3 , python 3.8, workaround go get github.com/christian-korneck/go-python3 But a bunch of errors occurred.
Python 3.7 install
C-like usage from golang - low level stuff
https://blog.filippo.io/building-python-modules-with-go-1-5/ goodread. But that’s not what I need.
Let’s look at Ardan’s lab way.
https://www.ardanlabs.com/blog/2020/09/using-python-memory.html
This is a bit more challenging but more understandable.
This is the way.
I should start with this right after fixing the make issue.
Back to build fixing
Do as samuel suggested. - no luck.
What I know so far. The issue is rooted with golang or protobuf or sth related. Since the issue is there for all the text editors including vim.
I found sth weird -Which go => /usr/local/go/bin/goWhen it gives /usr/local/bin/go to this dude https://stackoverflow.com/a/67419012/13580063
Okay, not so weird.
The interview went okay. They use photogenometry to generate those 3d maps out of their drone imagery. Their products sound interesting. They need frontend engineers to work on their platform. The interface currently looks almost like google maps. But 3d. Cool. I actually used the phrase.. “..I’m still in my 20s.. Don’t wanna die.. So can’t move to Bengalore anytime soon”
Not photogenometry. Photogrammetry. Also used by some old mars rovers. Wait, no it was sth else. I remember Shreyansh mentioning it. I wonder what all they’re planning for the dragonfly.
Focus. It’s been some days with this issue, you should get help.
Asked around a bunch of people on discord. No luck.
July 8
Let’s dig in.
Tries
1. Reinstall golang#2. https://stackoverflow.com/a/67419012/13580063 ? Nop.#3. See protoc installation details. Read more about protoc, protobugs
https://developers.google.com/protocol-buffers/docs/reference/go-generated#4. Read more about golang ecosystem - 30m and see if **which go **path is weird. 3. Also found this https://github.com/owncloud/ocis-hello/issues/62 Nop. 4. Let’s go with the error trails. 5. Wait, did I just graduate today. Oh no. Just like that. 6. Okay, grind.
Make generate is giving this.
GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go GO111MODULE=on go get -v github.com/micro/protoc-gen-micro/v2 GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --go_out=pkg/proto/v0 hello.proto protoc-gen-go: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --go_out: protoc-gen-go: Plugin failed with status code 1. make: *** [Makefile:176: pkg/proto/v0/hello.pb.go] Error 1
Then I try echo $GOPATH and It’s empty. go env GOPATH is right
So I set the GOPATH
export GOROOT=/usr/local/go export GOPATH=$HOME/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN
Now, I get this
GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --go_out=pkg/proto/v0 hello.proto protoc-gen-go: invalid Go import path "proto" for "hello.proto" The import path must contain at least one forward slash ('/') character. See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information. --go_out: protoc-gen-go: Plugin failed with status code 1. make: *** [Makefile:176: pkg/proto/v0/hello.pb.go] Error 1
Did this https://github.com/techschool/pcbook-go/issues/3#issuecomment-821860413 and the one below and started getting this```
GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --go_out=pkg/proto/v0 hello.proto protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --micro_out=pkg/proto/v0 hello.proto protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --microweb_out=pkg/proto/v0 hello.proto protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --swagger_out=logtostderr=true:pkg/proto/v0 hello.proto protoc-gen-swagger: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --swagger_out: protoc-gen-swagger: Plugin failed with status code 1. make: *** [Makefile:194: pkg/proto/v0/hello.swagger.json] Error 1
July 9
Now trying to read this from the error https://developers.google.com/protocol-buffers/docs/reference/go-generated#package
option go_package = "github.com/anaswaratrajan/ocis-jupyter/pkg/proto/v0;proto";
Tried this, new issue
GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --go_out=pkg/proto/v0 hello.proto protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --micro_out=pkg/proto/v0 hello.proto protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --microweb_out=pkg/proto/v0 hello.proto protoc \ -I=third_party/ \ -I=pkg/proto/v0/ \ --swagger_out=logtostderr=true:pkg/proto/v0 hello.proto protoc-gen-swagger: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --swagger_out: protoc-gen-swagger: Plugin failed with status code 1. make: *** [Makefile:194: pkg/proto/v0/hello.swagger.json] Error 1
Okay, so proto-gen-swagger is not in gopath as expected. So this isn’t working.
$(GOPATH)/bin/protoc-gen-swagger: GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2
Instead of protoc-gen-swagger, there’s protoc-gen-openapiv2. So I replace protoc-gen-swagger from last line in the makefile to the executable in the path.https://grpc-ecosystem.github.io/grpc-gateway/docs/development/grpc-gateway_v2_migration_guide/
Turns out they rename protoc-gen-swagger to protoc-gen-openapiv2
Oooo.. I just found out, option go_package = "github.com/anaswaratrajan/ocis-jupyter/pkg/proto/v0;proto";
This just made things weird. New directory github.com/anaswa... inside proto/v0/
So go_package path is messed up.
Just replacing swagger binary names in makefile lets you generate the proto files at github.com/anas… dir
Let’s try fixing the go_package path and then try to generate the annotations.proto and the openapiv2 files (the grpc gateway files)
Wait, you don't generate them.
option go_package = "./;proto";
This is the right way.
So yea, I’m able to generate the go-code now. But make is still failing and I should sleep now.
July 11
Ownclouders already tried to work on it. But for some reason, they didn’t make the changes. Why?
Look into this. Why they didn’t continue doing this.
https://github.com/owncloud/ocis-hello/issues/91
So what exactly is micro-web service? This protoc-gen-microweb is a protoc generator for micro web services. And it's generating this hello.pb.web.go
What just happened? New error/ Make generate gives
`GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 go generate github.com/anaswaratrajan/ocis-jupyter/pkg/assets panic: No files found goroutine 1 [running]: main.main() /home/anaswaratrajan/go/pkg/mod/github.com/!unno!ted/fileb0x[@v1](https://tmblr.co/mkYynE1Axr-EFCSIQIAtheA).1.4/main.go:101 +0x2765 exit status 2 pkg/assets/assets.go:12: running "go": exit status 1 make: *** [Makefile:83: generate] Error 1
Read more about the protoc generators used here.
0 notes