-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
110 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,112 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"----------\n", | ||
"\n", | ||
"> **How to Run This Notebook**\n", | ||
"\n", | ||
"You can run this notebook in Google Colab. The cell below should be run only once, and then followed by a change of runtime to \"Java (java)\". Refresh the browser before running any subsequent code. You can also run this notebook locally if you have the IJava kernel for Jupyter installed." | ||
] | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "view-in-github", | ||
"colab_type": "text" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/sualeh/What-a-Character/blob/java/Notebooks/3_java_unicode_numbers.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "mNLXOg88iW9A" | ||
}, | ||
"source": [ | ||
"----------\n", | ||
"\n", | ||
"> **How to Run This Notebook**\n", | ||
"\n", | ||
"You can run this notebook in Google Colab. The cell below should be run only once, and then followed by a change of runtime to \"Java (java)\". Refresh the browser before running any subsequent code. You can also run this notebook locally if you have the IJava kernel for Jupyter installed." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "DialDW_qiW9B" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"#@title Prepare Google Colab for IJava Kernel\n", | ||
"\n", | ||
"%%sh\n", | ||
"# Install java kernel\n", | ||
"wget -q https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip\n", | ||
"unzip -q ijava-1.3.0.zip\n", | ||
"python install.py\n", | ||
"\n", | ||
"# Install proxy for the java kernel\n", | ||
"wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n", | ||
"python install_ipc_proxy_kernel.py --kernel=java --implementation=ipc_proxy_kernel.py" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "OZwKmiHpiW9C" | ||
}, | ||
"source": [ | ||
"----------" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "SsrPAvDfiW9C" | ||
}, | ||
"source": [ | ||
"# Parsing Numbers" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "FxpsAUd5iW9C" | ||
}, | ||
"source": [ | ||
"## Handle Unicode Numbers\n", | ||
"\n", | ||
"Demonstrates number parsing functions can handle numeric values from other (non-English) languages." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "5TwVJqWPiW9C" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"final String hindiNumber = \"१२३४५६७८९०\";\n", | ||
"final int number = Integer.parseInt(hindiNumber);\n", | ||
"\n", | ||
"System.out.printf(\"%s = %d%n\", hindiNumber, number);" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Java", | ||
"language": "java", | ||
"name": "java" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "java", | ||
"file_extension": ".jshell", | ||
"mimetype": "text/x-java-source", | ||
"name": "java", | ||
"pygments_lexer": "java", | ||
"version": "17.0.6+9-LTS-190" | ||
}, | ||
"colab": { | ||
"provenance": [], | ||
"include_colab_link": true | ||
} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#@title Prepare Google Colab for IJava Kernel\n", | ||
"\n", | ||
"%%sh\n", | ||
"# Install java kernel\n", | ||
"wget -q https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip\n", | ||
"unzip -q ijava-1.3.0.zip\n", | ||
"python install.py\n", | ||
"\n", | ||
"# Install proxy for the java kernel\n", | ||
"wget -qO- https://gist.github.com/SpencerPark/e2732061ad19c1afa4a33a58cb8f18a9/archive/b6cff2bf09b6832344e576ea1e4731f0fb3df10c.tar.gz | tar xvz --strip-components=1\n", | ||
"python install_ipc_proxy_kernel.py --kernel=java --implementation=ipc_proxy_kernel.py" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"----------" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Parsing Numbers" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Handle Unicode Numbers\n", | ||
"\n", | ||
"Demonstrates number parsing functions can handle numeric values from other (non-English) languages." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"final String hindiNumber = \"१२३४५६७८९०\";\n", | ||
"final int number = Integer.parseInt(hindiNumber);\n", | ||
"\n", | ||
"System.out.printf(\"%s = %d%n\", hindiNumber, number);" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Java", | ||
"language": "java", | ||
"name": "java" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "java", | ||
"file_extension": ".jshell", | ||
"mimetype": "text/x-java-source", | ||
"name": "java", | ||
"pygments_lexer": "java", | ||
"version": "17.0.6+9-LTS-190" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |