Giter VIP home page Giter VIP logo

Comments (12)

skygragon avatar skygragon commented on June 15, 2024

"http error [500]" means leetcode.com response a 500 HTTP error, you can run leetcode show command again with "-vv" to enable trace log to see what happens in the HTTP traffic.

e.g.

leetcode show 1 -gxl java -vv

from leetcode-cli.

BkunS avatar BkunS commented on June 15, 2024

I guess it might be due to the api change on leetcode side that the "show" command no longer gives the problem descriptions. Would you mind checking it? Cuz without the descriptions, the leetcode-cli is almost useless. And here's what I got for running the code:

$ leetcode submit 576.out-of-boundary-paths.java -vv
[TRACE] REQUEST %s { url: 'https://leetcode.com/api/problems/algorithms/',
headers:
{ Cookie: 'LEETCODE_SESSION=;csrftoken=;',
'X-CSRFToken': '',
'X-Requested-With': 'XMLHttpRequest' },
expectedStatus: 200,
retry: 0,
callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode.com/api/problems/algorithms/
[TRACE] REQUEST %s onRequestResponse https://leetcode.com/api/problems/algorithms/ 200 { server: 'nginx',
date: 'Fri, 09 Jun 2017 03:27:53 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding, Accept, Cookie',
'x-frame-options': 'SAMEORIGIN',
allow: 'GET, HEAD, OPTIONS' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode.com/api/problems/algorithms/
[TRACE] REQUEST %s response end https://leetcode.com/api/problems/algorithms/ 200 { server: 'nginx',
date: 'Fri, 09 Jun 2017 03:27:53 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding, Accept, Cookie',
'x-frame-options': 'SAMEORIGIN',
allow: 'GET, HEAD, OPTIONS' }
[TRACE] REQUEST %s end event https://leetcode.com/api/problems/algorithms/
[TRACE] REQUEST %s has body https://leetcode.com/api/problems/algorithms/ 240505
[TRACE] REQUEST %s emitting complete https://leetcode.com/api/problems/algorithms/
[TRACE] REQUEST %s { url: 'https://leetcode.com/problems/out-of-boundary-paths/submit/',
headers:
{ Cookie: ;',
'X-CSRFToken': '',
'X-Requested-With': 'XMLHttpRequest',
Origin: 'https://leetcode.com',
Referer: 'https://leetcode.com/problems/out-of-boundary-paths' },
expectedStatus: 200,
retry: 0,
body:
{ judge_type: 'large',
lang: 'java',
question_id: 576,
test_mode: false,
typed_code: '/*\r\n * [576] Out of Boundary Paths\r\n *\r\n * https://leetcode.com/problems/out-of-boundary-paths\r\n *\r\n * Hard (33.35%)\r\n * Total Accepted: \r\n * Total Submissions: \r\n * Testcase Example: '2\n2\n2\n0\n0'\r\n *\r\n * Can you solve this problem? 🤔\r\n */\r\npublic class Solution {\r\n public int findPaths(int m, int n, int N, int i, int j) {\r\n\t\treturn 0;\r\n }\r\n}\r\n' },
method: 'POST',
json: true,
_delay: 1,
callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode.com/problems/out-of-boundary-paths/submit/
[TRACE] REQUEST %s onRequestResponse https://leetcode.com/problems/out-of-boundary-paths/submit/ 500 { server: 'nginx',
date: 'Fri, 09 Jun 2017 03:27:55 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Cookie',
'x-frame-options': 'SAMEORIGIN' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode.com/problems/out-of-boundary-paths/submit/
[TRACE] REQUEST %s response end https://leetcode.com/problems/out-of-boundary-paths/submit/ 500 { server: 'nginx',
date: 'Fri, 09 Jun 2017 03:27:55 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Cookie',
'x-frame-options': 'SAMEORIGIN' }
[TRACE] REQUEST %s end event https://leetcode.com/problems/out-of-boundary-paths/submit/
[TRACE] REQUEST %s has body https://leetcode.com/problems/out-of-boundary-paths/submit/ 27
[TRACE] REQUEST %s invalid JSON received https://leetcode.com/problems/out-of-boundary-paths/submit/
[TRACE] REQUEST %s emitting complete https://leetcode.com/problems/out-of-boundary-paths/submit/

from leetcode-cli.

skygragon avatar skygragon commented on June 15, 2024

Seems there are at least 2 issues:

  1. the description is missing because leetcode.com doesn't provide info as before, we already have fixed for #39 , so you can update leetcode-cli again to have the fix.
  2. the submit failed with 500 error, I guess it might because there is a special unicode char "🤔" in the request that leetcode.com doesn't handle it well. I would dig this later, but you can try to delete that char in your java file to see if it works as I guessed.

from leetcode-cli.

BkunS avatar BkunS commented on June 15, 2024

I know what was going on. Guess my terminal doesn't have the right font or encoding to display some symbols as you just pointed out, and it went in the java file as squares which causes the problem. By deleting those squares solves the problem.
snipaste_20170609_000528
snipaste_20170609_000555

I think this issue is good to be closed.

from leetcode-cli.

skygragon avatar skygragon commented on June 15, 2024

After you updated leetcode-cli, you can remove the cache (~/.lc/out-of-boundary-paths.json), and it will show the right description as expected:

$ leetcode show 576
[576] Out of Boundary Paths

https://leetcode.com/problems/out-of-boundary-paths

* Hard (33.34%)
* Total Accepted:    2279
* Total Submissions: 6836
* Testcase Example:  '2\n2\n2\n0\n0'

There is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary in four directions (up, down, left, right). However, you can at most move N times. Find out the number of paths to move the ball out of grid boundary. The answer may be very large, return it after mod 109 + 7.

Example 1:

Input:m = 2, n = 2, N = 2, i = 0, j = 0
Output: 6
Explanation:




Example 2:

Input:m = 1, n = 3, N = 3, i = 0, j = 1
Output: 12
Explanation:




Note:

Once you move the ball out of boundary, you cannot move it back.
The length and height of the grid is in range [1,50].
N is in range [0,50].

from leetcode-cli.

BkunS avatar BkunS commented on June 15, 2024

Has new version updated on npm yet? It seems it is still 0.10.0 and nothing changed.

from leetcode-cli.

skygragon avatar skygragon commented on June 15, 2024

not published to npm yet, while you can install from github directly

$ npm install -g skygragon/leetcode-cli

More info: https://skygragon.github.io/leetcode-cli/install

from leetcode-cli.

BkunS avatar BkunS commented on June 15, 2024

I have permission issues of npm installing from private repo though there are some ways to work around, but no real solutions. I guess I'll just stick with official npm version and try installing it later when it's updated. Thanks a lot!

from leetcode-cli.

skygragon avatar skygragon commented on June 15, 2024

Are you saying the npm permission issue when trying to install it globally?

from leetcode-cli.

BkunS avatar BkunS commented on June 15, 2024

I have no issues installing it globally with sudo command, but have issues installing it from private GitHub repo. I saw the version on npm has bumped to 0.10.1, and after updating to it seems everything works again. Thanks!

from leetcode-cli.

Pyboon avatar Pyboon commented on June 15, 2024

[ERROR] Error: connect ECONNREFUSED 104.27.161.90:443 [0]
why I had the issue in ubuntu 16.04 OS ?

from leetcode-cli.

skygragon avatar skygragon commented on June 15, 2024

@Pyboon most time this connection refused error is due to a bad networking, it's too complex since every hop (e.g. routers, firewalls) might be the reason...

from leetcode-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.