Updated blog structure and added new post

parent 0c9e9df0
Pipeline #4580330 passed with stage
in 3 minutes 9 seconds
......@@ -7,6 +7,8 @@ tags:
- code-example
- c/cpp
---
### Summary
Armstrong numbers also known as narcissistic numbers.
Armstrong numbers are the sum of their own digits to the power of the number of digits.
......@@ -20,11 +22,11 @@ In this program will be find a 3 Digit number being entered by user is an Armstr
For more details on Armstrong Number [visit here](https://en.wikipedia.org/wiki/Narcissistic_number).
#### Screenshot
### Screenshot
![Output Screen for Armstrong Number Program](/images/armstrong_output.jpg)
#### Armstrong.cpp
### Code
This program is hardcoded to 3 digits only
......
---
title: Bye Blogger
date: 2016-10-12 20:52:00
categories:
- Personal Experience
tags:
- personal-experience
---
### Summary
My first blog in 2008-09 that was for sharing Software/Movies/Music/Ebooks information as RohanzShare was made up using Blogger.com which ran for couple of years well giving me good visitors.
Later I planned for creating blog for sharing my personal experience be it learning, code, anything with everyone which was active till I got in love with [Static Site Generators](https://www.staticgen.com/) like [Jekyll](https://jekyllrb.com), [Hexo](https://hexo.io) etc.
Also, I have built a PHP based site in 2011 that shared my codes and projects information with everyone, but due to lost of one of my server, I lost a huge amount of data in it. So now to get things back on track I like everything to be committed that is not only available to me but to everyone.
So, now I converted my completed website from [Blogger](https://blogger.com) and PHP based site to [Hexo](https://hexo.io) based static website committed on GitLab as [public repository](https://gitlab.com/rsakhale/rsakhale.gitlab.io).
### Blogger
Blogger was a good experience with drag/drop tools, a lot of customized sidebar widgets and many more. Using Blogger gave me nice learning on how easy the tool should be for the users, so that any one can use it and enjoy blogging.
This doesn't mean Blogger is bad or not a good platform to use, I will always recommend new users or active writers to continue blogging using Blogger. Discontinuing with Blogger and getting started with Static Site Generator is just my personal opinion.
### Hexo
Its just been couple of days I have been using Hexo till I added this article, using Hexo is amazing, the way themes/plugins work gives a lot of simplicity and readiness for usability. The structure and CLI hexo provides is simple yet powerful, once you know how it works you are gonna fall in love with it.
#### NexT Hexo Theme
[NexT](https://github.com/iissnan/hexo-theme-next) is amazing theme with lots of customizable config that makes it really easy to use. This theme provides a great flexibility onto usage and also gives a proficient look to the website/blog.
\ No newline at end of file
......@@ -8,17 +8,18 @@ tags:
- java
- swing
---
### Summary
In-order to convert from Celsius to Fahrenheit, we have to apply a simple logic onto Celsius "Multiply by 9, then divide by 5, then add 32".
Our code provides a simple GUI, where the user has to enter the temperature in Celsius and after clicking on convert displays the Fahrenheit temperature below button in the form of JLabel.
The Class has been designed by extending JPanel which can be called from other classes and added onto the JFrame for displaying.
#### Screenshot
### Screenshot
![Calculate Celsius to Fahrenheit Temperature in Java Screenshot](/images/output_celsius_fahrenheit_java.jpg)
#### C2F.java
### Code
```java
package com.rohansakhale.treedemo;
......
......@@ -8,17 +8,19 @@ tags:
- java
- swing
---
### Summary
In-order to convert from Fahrenheit to Celsius, we have to apply a simple logic onto Celsius "Deduct 32, then multiply by 5, then divide by 9".
Our code provides a simple GUI, where the user has to enter the temperature in Fahrenheit and after clicking on convert displays the Celsius temperature below button in the form of JLabel.
The Class has been designed by extending JPanel which can be called from other classes and added onto the JFrame for displaying.
#### Screenshot:
### Screenshot
![Calculate Fahrenheit to CelsiusTemperature in Java](/images/output_fahrenheit_celsius_java.jpg)
#### F2C.java
### Code
```java
package com.rohansakhale.treedemo;
......
......@@ -8,9 +8,11 @@ tags:
- java
- servlets
---
### Summary
This is a simple Calculator developed using Java Servlets, so it uses the form type in html & uses regex for validating the numerical values.
### Calculator.java
### Code
```java
/*
......
......@@ -9,6 +9,8 @@ tags:
- swing
- socket-programming
---
### Summary
One of the most basic starters program for demonstrating the proper use of Sockets in Java. <br />
The following code makes use of Swing components to illustrate the Client GUI side and the Server side plays the role in Console mode.
......@@ -27,7 +29,7 @@ The following code makes use of Swing components to illustrate the Client GUI si
1. Client's can stop chatting by just pressing the logout button.
1. Once client is logged out, his socket is also closed on server side.
### Classes involved in following code:
### Classes Present
1. Client Side
* ClientMain
......@@ -37,13 +39,15 @@ The following code makes use of Swing components to illustrate the Client GUI si
* MessageDispatcher
* MessageQueue
#### Screenshots
### Screenshots
![Concurrent Chat Application screenshot 1](/images/output_concurrent_chat_server_1.jpg)
![Concurrent Chat Application screenshot 2](/images/output_concurrent_chat_server_2.jpg)
![Concurrent Chat Application screenshot 3](/images/output_concurrent_chat_server_3.jpg)
![Concurrent Chat Application screenshot 4](/images/output_concurrent_chat_server_4.jpg)
### Code
#### ClientMain.java
```java
......
......@@ -7,15 +7,17 @@ tags:
- code-example
- java
---
### Summary
This program converts Integer number received from user and displays the binary form of that integer number onto the screen.
_This program explains the logic, but Java also provides in-built methods in java.lang package, which can be directly used in bigger projects._
#### Example:
### Example
<b>Integer class provides toBinaryString(int value) static method.</b>
**Integer class provides toBinaryString(int value) static method.**
#### ConversionProgram.java
### Code
```java
/*
......
......@@ -7,6 +7,8 @@ tags:
- code-example
- php
---
### Summary
The following program will help us create a web service which can be called via HTTP calls from any language example Java application that can be a mobile app, desktop app or web app.
**Goal is to retrieve data stored on a server**
......@@ -19,11 +21,11 @@ So when we make request to our web service by giving additional information via
The output data after requesting the server will be given into json format which can be accessed very easily from any language like Java etc.
##### [DEMO Get Teacher Data](http://demo.rohansakhale.com/getteacherdata.php)
#### [DEMO Get Teacher Data](http://demo.rohansakhale.com/getteacherdata.php)
You can also read on [Using JSON Web Service in Java](#)
#### getteacherdata.php
### Code
```php
/*
......
......@@ -9,6 +9,8 @@ tags:
- java
- c/cpp
---
### Summary
So by starting as a simple post toward my contribution for programming, lets see how messages can be displayed in different programming languages.
### Hello World in "C"
......
......@@ -7,11 +7,13 @@ tags:
- code-example
- c/cpp
---
### Summary
This is another algorithm which can be used to draw a line and this algorithm is better and gives a more accurate output than DDA algorithm we previously discussed
This is another example shown in Computer Graphics using C Language
#### Bresenhams.cpp
### Code
```cpp
#include "stdio.h"
......
......@@ -7,6 +7,8 @@ tags:
- code-example
- c/cpp
---
### Summary
This is a computer graphics related algorithm that draws line using graphics in C language.
Using this algorithm we won't get the exact required line, there are in-built graphics functions present in graphics.h header that gives a more better line.
......@@ -14,7 +16,7 @@ Using this algorithm we won't get the exact required line, there are in-built gr
But in-order to master algorithms we need to get a start with whatever we can learn with.
#### DDA.cpp
### Code
```cpp
#include "stdio.h"
......
......@@ -7,9 +7,11 @@ tags:
- code-example
- java
---
### Summary
Email Validator Program developed using pure Object Oriented Programming & String handling in Java during college days as an assignment.
### Ability of validating
### Ability of Validating
#### Username
......@@ -25,7 +27,7 @@ Email Validator Program developed using pure Object Oriented Programming & Strin
> rohan.sakhale@gmail.com **VALID**
> rohan123sakhale@gmail.com **VALID**
#### "@"
#### Special character "@"
> rohan@sakhale@gmail.com **INVALID**
> rohan@@gmail.com **INVALID**
......@@ -48,7 +50,7 @@ Email Validator Program developed using pure Object Oriented Programming & Strin
> rohan@rohan-rohan.com **VALID**
## Java Code
### Code
```java
/*
......
......@@ -7,15 +7,17 @@ tags:
- code-example
- php
---
### Summary
Simple program to get factorial number of any desired number by user.
The following code makes use of a function and with the help of loops and other variables returns the calculated Factorial value of the number.
#### Screenshot
### Screenshot
![Factorial number in PHP Screenshot](/images/factorial_output.jpg)
#### Factorial.php
### Code
```php
<?
......
......@@ -7,7 +7,11 @@ tags:
- code-example
- java
---
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
### Summary
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.
### Example
```
5! = 5 x 4 x 3 x 2 x 1 = 120
......@@ -19,11 +23,11 @@ The user has to enter the number and click on Calculate which displays the answe
The Class has been designed by extending JPanel which can be called from other classes and added onto the JFrame for displaying.
#### Screenshot
### Screenshot
![Factorial Program in Java](/images/output_factorial_java.jpg)
#### Factorial.java
### Code
```java
package com.rohansakhale.fact;
......
......@@ -7,6 +7,8 @@ tags:
- code-example
- java
---
### Summary
The following is a simple example on how to read & write data from a file.
For Writing data we need following objects
......@@ -21,12 +23,12 @@ For Reading data we need following objects
File Object -> FileReader Object -> BufferedReader Object
```
#### Expected Output
### Screenshot
![File IO Operation in Java Output](/images/java_file_io_output.jpg)
#### WriteReadDemo.java
### Code
```java
......
......@@ -7,13 +7,15 @@ tags:
- code-example
- c/cpp
---
### Summary
This is a funny time-pass program.
Give any input and check the output given there.
Idea taken from: mycfiles.com
#### Funny.cpp
### Code
```cpp
#include "stdio.h"
......
......@@ -8,6 +8,8 @@ tags:
- git
- social-coding
---
### Summary
Get On D (The) Line, just a phrase from the movie "[Internship](http://www.theinternshipmovie.com/)" which I have seen quite ago reminds me of the app they wanted to build for the competition with a catchy phrase "Get On The Line" something like Instagram does but the exact moment we click it and gets on the line. I don't want to get into the movie talks, but what I want to bring your focus is Get Your Self On The Line now.
As a programmer/developer there are tons of ways you can build up your rapport which can help you get a good job, the best way known till date was doing an outstanding project in final year, present the same in interview on which you will be judged, but talking the truth not all actually do the project truly and try to make up a fake impression and get the job, but as always private firms needs result the candidate gets proved wrong and woooo the candidate is out. This trend of interviewing and assuming what skills a candidate can possess is moving from a piece of paper (we call[Résumé](http://en.wikipedia.org/wiki/R%C3%A9sum%C3%A9)) towards the Online Platform.
......@@ -18,15 +20,19 @@ So, what? Ever heard about [Agile](http://en.wikipedia.org/wiki/Agile_software_
This is where our talk comes back on, **Get On D Line**, to represent yourself as a active collaborative member who connects with people and contributes with either his code or great discussions. There are many ways you can collaborate with others outside the world even being in school/college, some of them I will list down ahead. By coming online this way and presenting yourself with good contribution the recruiting applications that are coming up will capture all of this data and bring you up in top list. Check below the list of sites who can help you make a good online profile which makes recruiters getting easy one step near to you.
[![Get On D Line](http://4.bp.blogspot.com/-VyiQ9iDw0Lg/UtnwNep8ewI/AAAAAAAABoI/pClVSgC2M58/s1600/banner2.jpg)](http://4.bp.blogspot.com/-VyiQ9iDw0Lg/UtnwNep8ewI/AAAAAAAABoI/pClVSgC2M58/s1600/banner2.jpg)
![Get On D Line](/images/get-on-d-line-banner.jpg)
### Share with Online Tools
### [CodePen](http://codepen.io/) / [JSFiddle](http://jsfiddle.net/) / [PasteBin](http://en.wikipedia.org/wiki/Pastebin)
**[CodePen](http://codepen.io/) / [JSFiddle](http://jsfiddle.net/) / [PasteBin](https://en.wikipedia.org/wiki/Pastebin)**
Gotta question that needs to be asked with a snippet to be demoed, you will require a proper medium to store your code and demonstrate to the community with which the question will be understood much more properly, use these Online IDE's that give you a platform of sharing your code in easy way. This is another type of Social Coding that helps you code and share immediately rather maintaining repositories and versions of code, these sites are only good for sharing snippets & not projects.
Also this becomes another type of your profile that shows your work in snippet, often could be used as portfolio for showing out what you can code. CodePen/JSFiddle often could be useful for a JS Developer or UI Developer wherein you write HTML/CSS/JavaScript.
### [Stack Overflow](http://en.wikipedia.org/wiki/Stack_Overflow_(website)) / [LinkedIn Groups](http://en.wikipedia.org/wiki/LinkedIn#Groups) / [Google Groups](http://en.wikipedia.org/wiki/Google_Groups)
### Ask Question to Community
**[Stack Overflow](http://en.wikipedia.org/wiki/Stack_Overflow_(website)) / [LinkedIn Groups](http://en.wikipedia.org/wiki/LinkedIn#Groups) / [Google Groups](http://en.wikipedia.org/wiki/Google_Groups)**
As I said it is not mandatory for creating a profile/rapport you need to code, if you are good at something and someone over these groups have asked a question you could probably answer it in easier way and gain popularity. Stack Overflow & LinkedIn Groups give you badges showing your efforts. Also if someone searches over such questions on Google you get listed again here in several groups. So this approach will actually help you build a stronger rapport that a recruiter might be seeking.
......@@ -34,7 +40,9 @@ Also, it is again not mandatory that you always answer, there could be times you
So asking as well as answering adds value to the community hence you should be joining in.
### [GitHub](http://en.wikipedia.org/wiki/GitHub) / [Google Code](http://en.wikipedia.org/wiki/Google_Code) / [BitBucket](http://en.wikipedia.org/wiki/Bitbucket) / [Gitorious](http://en.wikipedia.org/wiki/Gitorious)
### Collaborate Online
**[GitLab](https://en.wikipedia.org/wiki/GitLab) / [GitHub](http://en.wikipedia.org/wiki/GitHub) / [BitBucket](http://en.wikipedia.org/wiki/Bitbucket)**
These are web-based [git](http://en.wikipedia.org/wiki/Git_(software)) version control system that allows you to create project and maintain its file version on every single [commit](http://gitref.org/basic/#commit). If you create an exciting project people from other region can contribute onto the project by just doing a[fork](http://en.wikipedia.org/wiki/Fork_(software_development)). This also maintains the credits of the original author as well as gives credits to new contributions. They provide a detail summary of the activity you perform with code or discussions which is now seen by recruiters before recruiting any of the applicant if data is available. By getting on the line this way you get a new rapport and get known for your knowledge globally.
......@@ -45,5 +53,6 @@ But coding is not the only way of contribution, you can also participate in disc
With the latest trend of Social Sourcing a candidate, the above profiles would be used for identifying skills and work of a candidate. These skills will be filtered out & best candidate will be chosen saving time & money of corporate's. So you need to make sure how would you shine up and get the perfect job you wished to.
### Conclusion
> ## Don't wait, Get On D Line, and start collaborating
> **Don't wait, Get On D Line, and start collaborating**
......@@ -8,11 +8,13 @@ tags:
- java
- swing
---
### Summary
This is an example displaying the usage of JList Swing Component Demo
Here we made a list with 3 Strings and added a display button which shows which of the list value is selected. We also made use of new Dialog box i.e. ConfirmDialogBox and also we made use of JApplet this time & not a JFrame. So inorder to initialise all the components we made use of its init() method which is called first when its loaded
#### JListDemo.java
### Code
```java
/*
......@@ -54,8 +56,7 @@ public class JListDemo extends JApplet implements ActionListener {
StringBuffer sb = new StringBuffer();
Object[] t = l.getSelectedValues();
for (int i = 0; i &lt; t.length; i++) {
sb.append(t[i]).append("
");
sb.append(t[i]).append("\n");
}
JOptionPane.showConfirmDialog(this, sb);
}
......
......@@ -8,9 +8,11 @@ tags:
- java
- swing
---
### Summary
This is an example displaying the usage of JTree Swing Component, how the default mutable nodes work, we can get their path using the TreePath class and hence we can form an heirarchical tree which on click displays the path of the node being selected.
#### JTreeDemo.java
### Code
```java
/*
......
......@@ -8,6 +8,8 @@ tags:
- java
- swing
---
### Summary
JTree is a control that displays a set of hierarchical data as an outline.
We will use it as a menu to navigate through various small applications we made previously.
......@@ -16,12 +18,14 @@ The tree will basically contain each program as a node when selected using mouse
Programs used in this code are already being posted before for practice, I will name the Class & the link to find the class
1. [Simple Calculator in Java]()
1. [Factorial Program in Java]()
1. [Calculate Celsius to Fahrenheit Temperature in Java]()
1. [Calculate Fahrenheit to Celsius Temperature in Java]()
### Reference Code
1. [Simple Calculator in Java](/2012/06/16/Simple-Calculator-in-Java/)
1. [Factorial Program in Java](/2012/06/16/Factorial-Program-in-Java/)
1. [Calculate Celsius to Fahrenheit Temperature in Java](/2012/06/16/Calculate-Celsius-to-Fahrenheit-Temperature-in-Java/)
1. [Calculate Fahrenheit to Celsius Temperature in Java](/2012/06/16/Calculate-Fahrenheit-to-Celsius-Temperature-in-Java/)
#### Screenshot
### Screenshot
![JTree Simple Practice Application in Java Output 1](/images/output_jtree_prac_app_1.jpg)
......@@ -33,7 +37,7 @@ Programs used in this code are already being posted before for practice, I will
![JTree Simple Practice Application in Java Output 5](/images/output_jtree_prac_app_5.jpg)
#### TreeDemo.java
### Code
```java
package com.rohansakhale.treedemo;
......
......@@ -8,13 +8,15 @@ tags:
- java
- socket
---
### Summary
This is a [socket program](https://en.wikipedia.org/wiki/Network_socket), it consists of Server side program & client side program.
_Server will provide web service for validating the number is prime or not and returns true or false._
_Client sends the integer number to the server & gets the respond accordingly._
#### Steps for running program
### Steps
1. Compile both classes
1. Run server class first
......@@ -22,6 +24,8 @@ _Client sends the integer number to the server & gets the respond accordingly._
> This will work only for single input, inorder to make it work for infinite input as per user, simple changes have to be made in both the codes.
### Code
#### Server Code: ServerPrime.java
```java
......
......@@ -7,6 +7,8 @@ tags:
- code-example
- php
---
### Summary
This is a small project quickly made by me after seeing link shortners on web.
We require only three files for our small project
......@@ -17,7 +19,9 @@ We require only three files for our small project
Also we require a database connection inorder to maintain all the links with their access id's
### index.php
### Code
#### index.php
```php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
......@@ -52,7 +56,7 @@ Also we require a database connection inorder to maintain all the links with the
</html>
```
### .htaccess
#### .htaccess
```apache-conf
RewriteEngine On
......@@ -62,7 +66,7 @@ Options +FollowSymlinks
RewriteRule ^v-(.*)$ go.php?id=$1 [QSA,L,NC]
```
### go.php
#### go.php
```php
<?php
......@@ -88,7 +92,7 @@ if ($_GET['id']) {
?>
```
### database script
#### SQL Script
```sql
create table url (
......@@ -100,6 +104,7 @@ create table url (
Inorder to run this program XAMPP was used as Local Server.
### Enhancements
This project can be improved further with the following points
......
......@@ -8,11 +8,13 @@ tags:
- java
- swing
---
### Summary
This is a small JAVA Swing GUI login validation program which takes username & password from user and compares with the default values pre-defined. If successful then shows success dialog box else shows failed dialog box.
Various swing components are used in making of this program and specially JPasswordField() is the class used to display a password textfield.
#### LoginDemo.java
### Code
```java
/*
......
......@@ -7,9 +7,11 @@ tags:
- code-example
- c/cpp
---
### Summary
This is an algorithm for Computer Graphics using C Language to draw a circle using the Midpoint Circle Algorithm
#### Midpoint.cpp
### Code
```cpp
#include "stdio.h"
......
......@@ -7,6 +7,7 @@ tags:
- c/cpp
- code-example
---
### Summary
Moving Stickman code in C Language using **Visual Studio**.
......@@ -26,7 +27,7 @@ This stickman moves on keys.
> Press any key and change character of stickman
#### C++ Code
### Code
```cpp
// MovingStickMan.cpp : Defines the entry point for the console application.
......
---
title: My Experience wiith ASP
title: My Experience with ASP
date: 2015/06/20
categories:
- Personal Experience
tags:
- personal-experience
---
### Summary
For me going school was just a regular day with no path why we are doing this until I met Claira Miss, in sixth standard, where I learnt importance of education and started scoring good since sixth standard but the path was not clear yet. Why are we studying, it was regular mugging up and scoring goods.
Till seventh Claira Miss boosted a lot of performance in me and she had to leave due to personal reasons which again made me lost in eight standard with no guide around me, I tried approaching to ASP during my 8th standard but due to less seats I was unfortunate. But I tried it again during my 9th standard and got admission with “**Amul Sir’s Private Tutorials**” where the journey began.
![Amul Sirs Private](http://aspclasses.in/assets/images/asp_banner2.png)
![Amul Sirs Private](/images/asp_banner2.png)
> ### Amul Sir the lead visionary of students @ASP focused in teaching the grounds up mostly in Mathematical and Scientific area defines a great path for students.
> **Amul Sir the lead visionary of students @ASP focused in teaching the grounds up mostly in Mathematical and Scientific area defines a great path for students.**
Sir always used to focus on what we will be doing ahead in life hence he was pretty sure to build every individuals foundation in stronger way by his excellent motivation and pushing individual beyond limits to become pacer in his own life, that’s a way he had introduced in our batch to highlight individual among everyone for not only scoring but for various other reasons, still I was never good at “scores” but sir let me be there once, it was a great motivation, I still remember it.
Mathematics and Physics the love of Amul Sir, inspired us as well with deep passion towards the field of Science. It was not just learn, but we learnt it with a purpose.
Mathematics and Physics the love of Amul Sir, inspired us as well with deep passion towards the field of Science. It was not just learning, but we learnt it with a purpose.
#### A purpose to achieve something out with Science.
......@@ -42,4 +44,6 @@ With this long post, I want to thanks sir once again for all the goodies and I l
Just to end with a quote that suites sir the best
> ### “Give a man a fish and you feed him for a day, teach a man how to fish and you feed him for a lifetime.”
\ No newline at end of file
### Quote
> **“Give a man a fish and you feed him for a day, teach a man how to fish and you feed him for a lifetime.”**
\ No newline at end of file
......@@ -5,5 +5,26 @@ categories:
tags:
- static-site-generator
---
### Summary
I always wonder how several plugins host their pages on GitHub and never realized that actually those were GitHub pages, thanks to GitLab Pages and their blogs & obvisouly well documentation helped me understand quite easily what these blog-aware static websites are and also helped me get started with it quite easily.
\ No newline at end of file
I always wonder how several plugins host their pages on GitHub and never realized that actually those were GitHub pages, thanks to GitLab Pages and their blogs & obvisouly well documentation helped me understand quite easily what these blog-aware static websites are and also helped me get started with it quite easily.
### Static Site Generators
This hosted pages are mostly generate with the help of Static Site Generators, there are several such tools available which are developed in Ruby, NodeJS, Go and many more different languages.
These tools are exceptionally greatly which can be a nice replacement towards CMS sites, but these sites are mostly meant for coders, so a normal layman person would still prefer using a CMS and getting the job done in easy ways. But my personal opinion I am in love with this SSG as everything happens by a Git commit.
#### Tools list
##### Jekyll
A Ruby based tool, a lot of users, strongly recommended by GitHub, is a good tool to get started with.
##### Hexo
A NodeJS based tool, great usability and readiness for a complete blog that you would like to have, good community support with plugins and themes availability
##### Middleman
A Ruby based tool, used by GitLab and has a good number of plugins/themes.
\ No newline at end of file
......@@ -7,6 +7,8 @@ tags:
- code-example
- php
---
### Summary
Regular working with arbitrary number is usually a tough job, normally for generating factorial number using the regular looping methods you can generate only upto 170, and it doesn't work for huge numbers.
**GMP** is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers.
......@@ -19,22 +21,22 @@ For complete reference on GMP functions [visit here](http://www.php.net/manual/e
The following code accepts a number from user and on the server side it is checked if numeric and passed onto the `gmp_fact()` method which returns the factorial of it and output is displayed on the screen.
#### gmp_try.php
### Code
```php
<?php
if (isset($_POST[\'submit\']) and $_POST[\'submit\'] == \'Generate\') {
if (isset($_POST[\'num\']) and is_numeric($_POST[\'num\'])) {
$num = $_POST[\'num\'];
if (isset($_POST['submit']) and $_POST['submit'] == 'Generate') {
if (isset($_POST['num']) and is_numeric($_POST['num'])) {
$num = $_POST['num'];
$fact = gmp_fact($num);
echo \'Factorial of Number (\' . $num . \') is\' . $fact . \'<br />\';
echo 'Factorial of Number (' . $num . ') is' . $fact . '<br />';
} else {
echo \'Enter proper number<br />\';
echo 'Enter proper number<br />';
}
}
?>
<form action=\"\" method=\"post\">
Enter Number: <input type=\"text\" name=\"num\" /><br />
<input type=\"submit\" name=\"submit\" value=\"Generate\" />
<form action="" method="post">
Enter Number: <input type="text" name="num" /><br />
<input type="submit" name="submit" value="Generate" />
</form>
```
\ No newline at end of file
......@@ -7,15 +7,17 @@ tags:
- code-example
- c/cpp
---