Sunday, March 6, 2016
C++ HTML Code Parser for generating Parent Child Relation based on Space Hierarchy
Unknown
6:54 AM
c++ html tags hierarchy parser
,
c++ space based parent child relation generator
,
cpp html parser
,
cpp read from file and show in console
No comments
:
This is a simple parser. It provides details about parent child relation by parsing spaces on tags. The input for the program is a text file containing html tags separated by space based on their relation of html syntax. For example,
No need to count the closing tag. The code above is translated to input ( by user ) for the program as,
In a future post I will convert the space based html hierarchy to proper html tags and vise versa.
Make sure input.txt is in the same directory as cpp code file. Also the code can output to text file. Just uncomment the commented freopen in which case it will write to file instead of showing in console.
1 | <html> |
1 | html |
Execution:
Sample Input:
1 | html |
Output:
1 | head is the 1 th child of html |
Cpp Program Code:
Make sure input.txt is in the same directory as cpp code file. Also the code can output to text file. Just uncomment the commented freopen in which case it will write to file instead of showing in console.
Saturday, March 5, 2016
</> Announcement:
Please white list this site in the browsers adblocking extensions to load
fonts and other resources properly. e.g adblock, ghostery
This site can be accessed by using following links:
http://quickgrid.blogspot.com
http://quickgrid.ml
BASH Shell Script Calculate Factorial by Reading From File and Passing data to Another script to Calculate
Unknown
6:07 AM
bash for loop
,
expression evaluation
,
factorial calculation
,
input from terminal
,
linux
,
passing script data to another script
,
read command line argument
,
read from file
,
shell scripting
No comments
:
BASH Shell Scripts Run order:
</> List:
cleanFile.sh
numberGenerator.sh
factorialMain.sh
factorial.sh
Details:
cleanFile.sh deletes all the contents of the file passed in the arguments. numberGenerator.sh generates numbers based on the code and writes to specified file. factorialMain.sh reads the file created by numberGenerator.sh line by line and passed the data read to factorial.sh to calculate and print result. factorial.sh is a standalone script. It can either use command line arguments passed to calculate factorial or if no arguments was passed then asks to enter a number then prints its factorial. These scripts can be modified to calculate other things or do file related tasks etc.Codes:
cleanFile.sh
numberGenerator.sh
factorialMain.sh
factorial.sh
Run Instruction:
Run each file by first bringing up terminal ( Shortcut: ctrl + alt + t ), then type the following,
Replace scriptName.sh with the actual script name such as, "factorialMain.sh". Also make sure to bring up terminal in the folder where the script is located, or cd to that directory then run the command. In order to pass command line arguments just call the script as above and add space separated numbers to it. For example,
bash scriptName.sh
It will print the factorial of 5 which is 120.
bash factorial.sh 5
Subscribe to:
Posts
(
Atom
)