Skip to content

Instantly share code, notes, and snippets.

View biswarupadhikari's full-sized avatar

Biswarup Adhikari biswarupadhikari

View GitHub Profile
@biswarupadhikari
biswarupadhikari / subdir.php
Created January 4, 2013 15:34
is_subdir php function. How to check is sub directory is php
<?php
function is_subdir($parent,$sub){
$parent=rtrim($parent,'/');
$sub=rtrim($sub,'/');
$parent=explode('/',$parent);
$sub=explode('/',$sub);
for($i=0;$i<count($parent);$i++){
if($parent[$i]!=$sub[$i]){
return false;
}
@biswarupadhikari
biswarupadhikari / gist:3304593
Created August 9, 2012 14:23
How to extract .tar.bz2 and .tar.gz file in Linux
Tar is an archiving utility in Linux. Lets see how can we extract various archived files in Linux using this utility. We will also see the meaning of the options provided with the commands. Type the following commands in terminal (Keyboard short cut: Ctrl+Alt+T in Ubuntu):
Extracting .tar.bz2:
tar xvjf filename.tar.bz2 location
Extracting .tar.gz:
tar xvzf filename.tar.gz location
Where:
x — extract
v — verbose (it will show the extracting files in the terminal)
@biswarupadhikari
biswarupadhikari / gist:4038614
Created November 8, 2012 12:50
How to Detect Right Click Linux Java JTable
jt.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
int r = jt.rowAtPoint(e.getPoint());
if (r >= 0 && r < jt.getRowCount()) {
jt.setRowSelectionInterval(r, r);
} else {
jt.clearSelection();
}
int rowindex = jt.getSelectedRow();
@biswarupadhikari
biswarupadhikari / increaseVolume.sh
Created February 9, 2013 05:17
How to increase video volume using ffmpeg
ffmpeg -i Manage-Event-Using-ICAgenda-Demostration.mp4 -vol 1280 -vcodec copy /home/adidac/Desktop/test.mp4
@biswarupadhikari
biswarupadhikari / joomlaLoginValidator.php
Created August 10, 2012 07:08
How to validate Joomla Login
<?php
function validateLogin($username,$password){
jimport( 'joomla.user.authentication');
$auth = & JAuthentication::getInstance();
$credentials = array( 'username' => $username, 'password' => $password );
$options = array();
$response = $auth->authenticate($credentials, $options);
if ($response->status === JAUTHENTICATE_STATUS_SUCCESS) {
$response->status = true;
$user=JFactory::getUser($username);
@biswarupadhikari
biswarupadhikari / selectMysql.jsp
Created July 30, 2012 06:57
How to Select And Display Mysql Record Using JSP
<%@page import="java.sql.*"%>
<%@page import="com.mysql.jdbc.PreparedStatement"%>
<%@page import="com.mysql.jdbc.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
@biswarupadhikari
biswarupadhikari / gist:3969459
Created October 28, 2012 18:53
Backtrack5 GUI Not Showing Or startx not working
Run These Command
fix-splash
rm /root/.kde/cache-root/icon-cac­he.kcache
rm /root/.kde/cache-root/plasma_t­heme_Volatile.kcache
rm /root/.kde/cache-bt/icon-cache­.kcache
rm /root/.kde/cache-bt/plasma_the­me_Volatile.kcache
startx
@biswarupadhikari
biswarupadhikari / paypalCurrencySelectDropDown.html
Last active May 19, 2017 15:47
Paypal Currency Select Drop Down
<select name="currency_code">
<option value="">Select Currency</option>
<option value="AUD">Australian Dollar</option>
<option value="BRL">Brazilian Real </option>
<option value="CAD">Canadian Dollar</option>
<option value="CZK">Czech Koruna</option>
<option value="DKK">Danish Krone</option>
<option value="EUR">Euro</option>
<option value="HKD">Hong Kong Dollar</option>
<option value="HUF">Hungarian Forint </option>
@biswarupadhikari
biswarupadhikari / validate.js
Created November 19, 2013 03:28
Validate Version using Javascript
function validateVersion(version){
var pat=/^[0-9]{1,3}.[0-9]{0,3}.[0-9]{0,3}$/;
return pat.test(version)
}
Validate Version
var version="10.2.5";
if(validateVersion(version)){
@biswarupadhikari
biswarupadhikari / Model.php
Created October 23, 2013 21:32
Joomla Custom Server Side Va
/**
* Validate Data
*/
function validate($form, $data,$group=null){
$status=true;
if(!$this->EmailValidate($data['email'])){
$status=false;
}
if($status){
return $data;