Commit 6b8c2f7d authored by Rohan Sakhale's avatar Rohan Sakhale

Updates

parent 102dfcbc
Pipeline #4551704 canceled with stage
......@@ -68,20 +68,48 @@ pagination_dir: page
## Themes: https://hexo.io/themes/
theme: aloha
menu:
Home:
name: HOME
value: /index.html
icon: home
Rss:
name: RSS
value: /atom.xml
icon: rss
Codes:
name: CODES
value: /categories/Codes
icon: code
About:
name: ABOUT
value: /About
icon: quote right
Archives:
name: ARCHIVES
value: /archives
icon: history
Company:
name: COMPANY
value: http://about.saiashirwad.com
icon: users
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type:
# aloha extra config
sidebar:
bio: >
Expertised in Web/Android Application Development and
passionate about sharing knowledge helps me stay connected
with people and embrace the knowledge into productivity
bio: PHP/Java/GitLab Fan, Passionate Developer and Loves Teaching
subtitle: PHP/Java/GitLab Fan, Passionate Developer and Loves Teachings
location: In front of PC
social:
github: https://github.com/RohanSakhale
gitlab: https://gitlab.com/rsakhale
twitter: https://twitter.com/RohanSakhale
\ No newline at end of file
git: https://gitlab.com/rsakhale
twitter: https://twitter.com/RohanSakhale
feed:
type: atom
path: atom.xml
limit: 20
hub:
\ No newline at end of file
---
title: About
date: 2016-10-10 23:10:10
---
---
title: Email Validation Script
date: 2011/06/27
categories:
- Codes
tags:
- code-example
- java
---
Email Validator Program developed using pure Object Oriented Programming & String handling in Java during college days as an assignment.
### Ability of validating
#### Username
> _rohan@gmail.com **INVALID**
> .rohan@gmail.com **INVALID**
> rohan$sakhale@gmail.com **INVALID**
> rohan^sakhale@gmail.com **INVALID**
> rohan.@gmail.com **INVALID**
> 12rohan@gmail.com **INVALID**
> rohansakhale@gmail.com **VALID**
> rohan_sakhale@gmail.com **VALID**
> rohan.sakhale@gmail.com **VALID**
> rohan123sakhale@gmail.com **VALID**
#### "@"
> rohan@sakhale@gmail.com **INVALID**
> rohan@@gmail.com **INVALID**
> @@gmail.com **INVALID**
> rohan@gmail.com **VALID**
#### Domain Name
> rohan@.gmail.com **INVALID**
> rohan@a.com **INVALID**
> rohan@aaa.123 **INVALID**
> rohan@aa.co.com.in **INVALID**
> rohan@-gmail.com **INVALID**
> rohan@gmail_gmail.com **INVALID**
> rohan@gmail.com **VALID**
> rohan@gmail.co.in **VALID**
> rohan@123.com**VALID**
> rohan@gmail.in **VALID**
> rohan@rohan-rohan.com **VALID**
## Java Code
```java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package emailverifieroop;
import java.io.*;
/**
*
* @author RohanSakhale
*/
public class EmailVerifier {
String s;
public EmailVerifier() {
s = "";
}
public EmailVerifier(String s) {
this.s = s;
}
void setEmail(String email) {
this.s = email;
}
/**
* Accept string from user
*/
void accept() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
s = br.readLine();
br.close();
}
/**
* Display string entered
*/
void display() {
System.out.println("You have entered: " + s);
}
/**
* Validate username from email
*/
boolean checkUsername() {
if (s.length() >= 3) {
for (int i = 0; i < s.indexOf("@"); i++) {
if (i != 0 && (s.charAt(i) == '_' || s.charAt(i) == '.')) {
continue;
}
if ((int) s.charAt(i) < 47 && (int) s.charAt(i) > 58) {
if (s.startsWith(Integer.toString(i)) == true) {
return false;
}
}
if ((int) s.charAt(i) < 47) {
return false;
} else if ((int) s.charAt(i) > 57 && (int) s.charAt(i) < 65) {
return false;
} else if ((int) s.charAt(i) > 91 && (int) s.charAt(i) < 97) {
return false;
} else if ((int) s.charAt(i) > 123) {
return false;
}
}
return true;
} else {
return false;
}
}
/**
* Validate email username
*/
boolean checkEmailUsername() {
if (s.indexOf("@") >= 3 && s.charAt(s.indexOf("@") - 1) != '.' && s.charAt(s.indexOf("@") - 1) != '_') {
for (int i = 0; i < s.indexOf("@"); i++) {
if (i != 0 && (s.charAt(i) == '_' || s.charAt(i) == '.')) {
continue;
}
if ((int) s.charAt(i) < 47 && (int) s.charAt(i) > 58) {
if (s.startsWith(Integer.toString(i)) == true) {
return false;
}
}
if ((int) s.charAt(i) < 47) {
return false;
} else if ((int) s.charAt(i) > 57 && (int) s.charAt(i) < 65) {
return false;
} else if ((int) s.charAt(i) > 91 && (int) s.charAt(i) < 97) {
return false;
} else if ((int) s.charAt(i) > 123) {
return false;
}
}
return true;
} else {
return false;
}
}
/**
* Validate "@" exists
*/
boolean checkPresenceOfSymbol() {
if (s.indexOf("@") == -1) {
return false;
} else {
return true;
}
}
/**
* Validate "@" is not the last character of string
*/
boolean checkEmailSymbol() {
if (s.indexOf("@") == s.lastIndexOf("@")) {
return true;
} else {
return false;
}
}
/**
* Validate the domain name
*/
boolean checkDomainName() {
int count = 0;
if (s.charAt(s.indexOf("@") + 1) == '_' || s.charAt(s.indexOf("@") + 1) == '-') {
return false;
}
if (s.indexOf(".", s.indexOf("@")) - s.indexOf("@") >= 3) {
for (int i = s.indexOf("@") + 1; i < s.length(); i++) {
if (s.charAt(i) == '.') {
count++;
if (count > 2) {
return false;
}
}
}
for (int i = s.indexOf("@") + 1; i < s.length(); i++) {
if ((s.charAt(i) == '.' || s.charAt(i) == '-')
|| s.indexOf("-") - s.indexOf("@") > 1) {
continue;
}
if ((int) s.charAt(i) < 47) {
return false;
}
if ((int) s.charAt(i) > 47 && (int) s.charAt(i) < 57) {
continue;
}
if ((int) s.charAt(i) < 97) {
return false;
}
if ((int) s.charAt(i) > 123) {
return false;
}
}
if (s.lastIndexOf(".") == s.length() - 4) {
return true;
} else if (s.lastIndexOf(".") == s.length() - 3) {
return true;
} else if (s.indexOf(".", s.indexOf("@")) == s.length() - 2 && s.lastIndexOf(".") == s.length() - 5) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
* Validate string as email
*/
boolean checkEmail() {
if (!checkEmailUsername()) {
return false;
}
if (!checkPresenceOfSymbol()) {
return false;
}
if (!checkDomainName()) {
return false;
}
if (!checkEmailSymbol()) {
return false;
}
return true;
}
}
```
---
title: Link Shortening Script
date: 2016-10-10 23:23:58
categories:
- Codes
tags:
- code-example
- php
---
---
title: Moving Stickman
date: 2011/06/27
categories:
- Codes
tags:
- c/c++
- code-example
---
Moving Stickman code in C Language using **Visual Studio**.
Customized functions for Visual Studio 2010 to act same as Turbo C
> `textcolor()` "Changes text color"
> `clrscr()` "Clears screen output"
> `gotoxy()` "Move cursor to x,y position"
This stickman moves on keys.
> `w` ==> up
> `a` ==> left
> `s` ==> down
> `d` ==> right
> `c` ==> changes the color
> Press any key and change character of stickman
#### C++ Code
```cpp
// MovingStickMan.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <Windows.h>
// Clear screen output
void clrscr()
{
system("cls");
}
// move cursor to x,y co-ordinates
void gotoxy(int a,int b)
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD Cord;
Cord.X = a;
Cord.Y = b;
SetConsoleCursorPosition(hStdOut,Cord);
}
// Change text color
void textcolor(int a)
{
int fontcolor = a;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
int color_A = 0;
color_A = _rotl(color_A,4) | fontcolor;
SetConsoleTextAttribute(hStdOut,a);
}
// Define global variables
char c;
int x=10,y=5;
int color=1;
/**
* Draw Sleeping Line with
*
* @param x "X co-ordinate of cursor position"
* @param y "Y co-ordinate of cursor position"
* @param len "Length of sleeping line to print"
* @param ch "Character to be used for printing"
*/
void sl(int x,int y,int len,char ch)
{
int i=0;
for(i=0;i<len;i++)
{
gotoxy(x+i,y);
putch(ch);
}
}
/**
* Draw Sleeping Line with
*
* @param x "X co-ordinate of cursor position"
* @param y "Y co-ordinate of cursor position"
* @param len "Length of vertical line to print"
* @param ch "Character to be used for printing"
*/
void vl(int x,int y,int len,char ch)
{
int i=0;
for(i=0;i<len;i++)
{
gotoxy(x,y+i);
putch(ch);
}
}
/**
* Draw stickman
*
* @param x "Starting x co-ordinate of stickman"
* @param y "Starting y co-ordinate of stickman"
* @param a "Character used for priting stickman"
*/
void sm(int x,int y,char a)
{
sl(x,y,5,a);
vl(x,y+1,3,a);
sl(x+1,y+3,3,a);
vl(x+4,y+1,3,a);
vl(x+2,y+4,7,a);
sl(x-3,y+6,11,a);
vl(x-3,y+7,1,a);
vl(x+7,y+7,1,a);
sl(x-1,y+11,7,a);
vl(x-1,y+12,3,a);
vl(x+5,y+12,3,a);
}
/**
* Move stickman to new position
*
* @param m "Operation used to move stickman"
*/
void move(char m)
{
switch(m)
{
case 'w':
sm(x,y,' ');
y--;
sm(x,y,c);
break;
case 'a':
sm(x,y,' ');
x--;
sm(x,y,c);
break;
case 's':
sm(x,y,' ');
y++;
sm(x,y,c);
break;
case 'd':
sm(x,y,' ');
x++;
sm(x,y,c);
break;
case 'c':
if(color==16)
color=1;
else
color++;
textcolor(color);
sm(x,y,c);
break;
default:
c = m;
sm(x,y,c);
}
}
/**
* Entry point of application
*/
int _tmain(int argc, _TCHAR* argv[])
{
char mv;
clrscr();
gotoxy(15,15);
printf("Enter character for Stickman==> ");
scanf("%c",&c);
clrscr();
sm(x, y, c);
// Iterate the loop till use presses `q` for exit
do
{
mv = getch();
move(mv);
}while(mv!='q');
getch();
return 0;
}
```
\ No newline at end of file
---
title: Vartak Integrity 2014 - Tribute to the Legends
date: 2014/01/05
categories:
- Personal Experience
tags:
- Annual Festival
- Tech-Cult Fest
- Vartak Integrity
---
<div>[![](http://4.bp.blogspot.com/-s_sHteGMcgU/UtgxLRgg_4I/AAAAAAAABno/Iknc5LFxQik/s1600/logo.png)](http://4.bp.blogspot.com/-s_sHteGMcgU/UtgxLRgg_4I/AAAAAAAABno/Iknc5LFxQik/s1600/logo.png)</div>
......
---
title: Yes We Can
date: 2011/08/25
categories:
- Inspirational
tags:
- Learning
- Motivational
---
Have you heard of Roger Bannister? He was the first athlete to run the mile in less than four minutes.
**_It’s important to understand that our achievements in life are limited not by what we can do, but by what we think we can do. More than ability, it’s our attitude that makes the difference. As Henry Ford said, “If you think you can, you can. And if you think you can’t, you are right”._**
His rival – Charles Landy – had thrice run the mile in less than 4 minutes 2 seconds without breaching the 4 minute mark. The four minute barrier was “like a wall”, Landy had said. But guess what? Just 56 days after Bannister’s feat, Landy ran the mile in 3 minutes 57.9 seconds. And by 1957, 16 athletes around the world ran the mile in under 4 minutes. The 4 minute mental barrier was truly shattered!
<div>In doing so, he not only broke the four-minute barrier, but also taught us all a valuable lesson.</div>
<div>Back in the 1950′s, the world record – 4 minutes 1.4 seconds – was held by Sweden’s Ginder Haegg. The record stood for several years since it was set in 1945\. Athletes, experts and the world were convinced that it was impossible to run a mile in less than four minutes. Some even argued that the human body was biologically incapable of running the mile in less than four minutes!</div>
<div>And then, on 6th May, 1954, Roger Bannister did the impossible. He broke the four minute barrier, finishing the race in 3 minutes, 59.4 seconds.</div>
<div>[![](http://creativecapital.nl/images/speakers/adapted/charleslandry.png)](http://creativecapital.nl/images/speakers/adapted/charleslandry.png)
What really happened? Did coaches get smarter and teach the athletes new techniques? Did running shoes get more sophisticated? Did bodies suddenly get stronger? No. The 4 minute barrier it turned out was not a physiological one – just a mental one! As Roger Bannister explained later, it seemed illogical that you could run a mile in 4 minutes and a bit, but not break 4 minutes. His mind refused to accept that barrier. That made all the difference.</div>
<div>Once that mental barrier was broken by Bannister, everyone believed it could be done! And once the belief changed, the rest was easy.</div>
<div>You will probably find your mind constantly grappling with two competing thoughts: ‘I can’t!’ and ‘I can!’ How do you ensure the ‘I can’ wins? How can we break our mental barrier of ‘I can’t'?</div>
<div>[![Henry Ford](http://myloudmind.files.wordpress.com/2011/04/henry_ford.jpg?w=175&h=207 "Henry Ford")](http://myloudmind.files.wordpress.com/2011/04/henry_ford.jpg?w=175&h=207) There was a man in Alaska who had a black dog and a white dog. His dog fights attracted large crowds. Every week people would bet on which dog would win. Sometimes the black dog won, and sometimes the white one. One lady noticed that no matter which dog won, the owner always bet on the right dog, and won each week. When the man retired the two dogs, the lady asked him the secret.</div>
<div>“Simple,” said the man. “I always bet on the dog I had been feeding all week.”</div>
<div>So whether ‘I can’t’ wins in your mind or ‘I can’, depends on which thought you are feeding!</div>
<div>Feed the ‘I can’ dog in your mind. The thought you feed, grows! Focus on your strengths, and they will grow. Or keep thinking of your weaknesses and your fears. And unfortunately they’ll grow too.</div>
<div>You won’t always find a Bannister to break your mental barrier. You need to do it yourself. Once you start feeding the ‘I can’ thought, you will achieve more than you ever thought was possible!</div>
<div>_Originally Taken from my friends site: [http://myloudmind.wordpress.com](http://myloudmind.wordpress.com/)_</div>
<div>_Reason to share, found it useful and very inspiring for all youngsters._</div>
\ No newline at end of file
---
title: Get On D Line
date: 2014/01/21
categories:
- Collaboration
tags:
- Online Activity
- GIT
- Social Coding
---
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.
......