Ma Karma Phalahe Durbo Matesangatsvali Karmani" Bagavad Gita( 2- 48)
asks us to do our karma ( Work) and says that the benefits of the work will be rewarded.
![]() |
| Image from Google.com |
import urllib2
from BeautifulSoup import BeautifulSoup
import sys
data=urllib2.urlopen(sys.argv[1]).read();
soup = BeautifulSoup(''.join(data))
code=soup('div', {'id' : 'code_frame'})
soup = BeautifulSoup(''.join(str(code[0]).strip()))
code_text = soup.div.div
text=''.join(BeautifulSoup(str(code_text).strip()).findAll(text=True))
code_for_vim = BeautifulSoup(str(text).strip(), convertEntities=BeautifulSoup.HTML_ENTITIES)
print code_for_vim
fun!pasteCodeFromPasteBin()
let g:binLink = input("Enter valid pastebin link : ")
let g:data=system('python ~/.vim/plugin/beautiful.py '.g:binLink)
set paste
exec "normal O".g:data
startinsert
endfun
let g:data=system('cat '.bufname("%").'| perl -p -e ''s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg''')
let g:query='paste_private=0&paste_code='.theg:data.'&paste_name='.g:name.'&paste_email='.g:pastebin_emailid.'&paste_format='.g:pastebin_language
let g:out=system('curl -d -s"'.g:query.'" http://pastebin.com/api_public.php ')
// Include the WURFL/Application.php file
require_once "WURFL_Installation_Dir/WURFL/Application.php";
// Provide the absolute or relative path to your wurfl-config.xml
$wurflConfigFile = "wurfl-config.xml";
// Create WURFL Configuration from an XML config file
$wurflConfig = new WURFL_Configuration_XmlConfig($wurflConfigFile);
// Create a WURFL Manager Factory from the WURFL Configuration
$wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
// Create a WURFL Manager
$wurflManager = $wurflManagerFactory->create();
?>
curl -o example.html www.example.com ##cURL can write the output it retrieves to a file with the -o flag$>curl www.example.com
int grep (char *regexp, char *text)
{
if (*regexp == '$' ){ /*End of regular expression*/
if ( *(regexp+1) == '\0' ){
return 1;
} else {
return 0;
}
} else if ( *regexp == '.' ) { /*Single character presence*/
return grep ( regexp + 1, text + 1 );
} else if ( *regexp == '*') { /*multi character presence*/
return matchstar(regexp+1, text);
} else if ( *regexp == *text ) {
return grep ( regexp + 1, text + 1 );
} else {
return 0;
}
}
int matchstar(char *regexp, char *text)
{
if ( grep (regexp, text ) ){ /*end of multi character match*/
return 1;
} else {
matchstar(regexp, text+1);
}
}
int main(int argc, char **argv)
{
FILE *file;
char text[200];
char c;
size_t size = 0;
if (argc >= 3) {
file = fopen(argv[1], "r");
while(EOF != (c = getc(file))){
if (c=='\n'){
text[size] = '\0';
int i = 0;
for ( i = 0; i < size; i++){
if (grep(argv[2], text + i)) {
printf("%s\n", text);
break;
}
}
size = 0;
} else {
text[size] = c;
size++;
}
}
}
return 0;
}
[~/CODE]
13:04:24 $ gcc -o grep grep.c
[~/CODE]
13:04:36 $ gedit grep.c
[~/CODE]
13:37:32 $ cat test
my
myname is
my name is khan
dog
cat is my pet
peterson is an awesome player
[~/CODE]
13:37:35 $ ./grep test m*k$
my
myname is
my name is khan
cat is my pet
peterson is an awesome player
[~/CODE]
13:37:39 $ ./grep test dog$
dog
[~/CODE]
13:37:43 $ ./grep test awsome$
[~/CODE]
13:37:49 $ ./grep test aw.some$
peterson is an awesome player


2)after that subtract two images I(Final)= I(Reference) -I(Real-time)Y = 0.3*R + 0.59*G + 0.11*B
I=RsterScan(I(Final))
if [value > 100]
I = 255
else
I = 0
if output is ERROR: capture is NULL than it might be possible your camera is incompatible with OpenCV
#include "cv.h"
#include "highgui.h"
#include
// A Simple Camera Capture Framework
int main() {
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
if( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
// Show the image captured from the camera in the window and repeat
while( 1 ) {
// Get one frame
IplImage* frame = cvQueryFrame( capture );
/* if( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}*/
cvShowImage( "mywindow", frame );
// Do not release the frame!
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator
if( (cvWaitKey(10) & 255) == 27 ) break;
}
// Release the capture device housekeeping
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );
return 0;
}
so, finally i know that how to create a patch :D,this is a beautiful concept to remove a bug by using simple Linux commands . The command 'diff' and 'patch' create a powerful combination and hit the bug from the program :) ,diff command is widely used to get a difference between original file and updated file and this difference is stored in a patch file and through this way other people who have only a original file can change it in to a update file by applying a patch using a patch file.
create a patch
we create a patch by using diff command , suppose we have to file 'original' and 'updated' the content of original file is "my name is aman" and the content of updated file is "my name is neshu",and we have to conver the original file in to the updated file by applying a patch and patch would be created as,
$>diff original updated > patchfile.patch
now patchfile.patch conatin a difference of both files
$>cat patchfile.patch
1c1
< my name is aman
---
>my name is neshu
1c1 denotes that there is some thing to change at 1st line
similarly 'd' is for delete and 'a' is for add
As you may have noticed, I omitted explaining what the 3 -'s are for. They indicate the end of the lines that should be replaced and the beginning of the lines that should replace them. They separate the old and the new lines.
Applying a patch
Applying a patch is a very simple task , after applying a patch on original file it will convert it in to updated file ,
$>patch original patchfile.patch
patching file original
original file is now converted in to updated
--
Happy Patching :)
:-fat0ss