document.addEventListener(
'dblclick', function(event) {
alert("Double-click disabled!");
event.preventDefault();
event.stopPropagation();
},
true//capturing phase!!
);
Saturday, November 18, 2017
Javascript to disable double-clicking on a webpage
Use a capture phase event listener on the document:
Etichete:
capture,
dblclick,
double-click,
event,
Javascript,
webpage
Saturday, October 25, 2014
Thursday, March 28, 2013
numbering the first line using lineno package with modulo option
Here is a how number the first line when modulo option is enabled on lineno LaTeX package:
Etichete:
first line,
latex,
line numbering,
lineno
Saturday, December 15, 2012
How to show Owncloud svg icons?
You need to include in .htaccess file ( create if it doesn't exist) the from the root folder of owncloud the following line:
AddType image/svg+xml svg
Monday, August 6, 2012
example of citation of an ISO standard in BibTeX
This is an example of how to cite an ISO standard in BibTeX:
@techreport{ISOPDF,
author = {ISO},
Institution = {International Organization for Standardization},
address = {Geneva, Switzerland},
Title = {Document management---{P}ortable document format---{P}art~1: {PDF}~1.7},
number = {32000\char"2012 1:2008},
Type = {ISO},
Year = {2008}
}
Note:\char"2012 from number field is figure dash (‒). The ISO standard above is ISO 32000‒1:2008.
Thursday, July 26, 2012
explicit label
Here is a
label command that lets you to set the label, the \ref output and the \pageref output in a LaTeX document
Monday, April 9, 2012
Share a link on Google Plus
To share an url on Google Plus put an a tag with the following href attribute:
'https://plus.google.com/share?url='.urlencode($URL)
Saturday, October 22, 2011
remove i386 from amd64 Ubuntu systems
Upgrading an amd64 Ubuntu to oneiric caused the package manager to load not only amd64 list of packages, but also i386 ones. The solution is to remove the
Since Ubuntu 12.10, you should use
multiarch file from /etc/dpkg/dpkg.cfg.d :# cd /etc/dpkg/dpkg.cfg.d # mv multiarch multiarch.backup # aptitude update Since Ubuntu 12.10, you should use
%dpkg --remove-architecture i386
Tuesday, August 9, 2011
figure dash in XeLaTeX
Figure dash ‒ is used for dashes in numbers (0763‒5345). It does not indicate a range, for which the en dash is used. In LaTeX there are commands for:
- endash:
\textendash - emdash:
\textemdash - minus:
\textminus
Because the code for figure dash is 0x2012 I define the following command for a figure dash in XeLaTeX:
\newcommand{\textfigdash}{\char"2012 }%figure dash ‒
Monday, March 28, 2011
URL rewriting tutorial
a very good apache url rewriting tutorial is here.
Monday, March 7, 2011
latex: arabic footnotes in minipage environment
To get arabic footnote markers in the minipage environment renew \thempfn command:
\begin{minipage}{\textwidth}
\renewcommand{\thempfn}{\arabic{mpfootnote}}
...
\end{minipage}
Saturday, February 26, 2011
latex warning output
To make latex print an warning at output one can use:
One can define a \todo command to get warnings about uncompleted sections. The following todo command will print a
in the PDF and the warning message passed as a parameter
Code for pasting in LaTeX package(.sty file)
\@latex@warning{My message}prints "file.tex:10: My message on input line 10"\@latex@warning@no@line{My message}prints "file.tex:0: My message"
One can define a \todo command to get warnings about uncompleted sections. The following todo command will print a
| TODO... |
\todo{Finish Thanks section!}Code for pasting in LaTeX package(.sty file)
\makeatletter
\newcommand{\todo}[1][]{\@latex@warning{TODO #1}\fbox{TODO\dots}}
\makeatother
Friday, February 25, 2011
bugfix> remove unwanted spaces in tokenizer package
As notice here \GetTokens inserts unwanted spaces. The bugfix is to use the following code instead of just "\usepackage[trim]{tokenizer}":
I will report this bugfix to the developer Sascha Herpers
\usepackage[trim]{tokenizer}
\def\SH@GetTokens#1,#2\@empty{%
\def\SH@token{#1}%
\ifx\SH@trimtokens\SH@true% strip spaces if requested
\TrimSpaces\SH@token%
\fi%
\SH@DefineCommand{\SH@FirstArgName}{\SH@token}%
\SH@DefineCommand{\SH@SecondArgName}{#2}%
}
\def\SH@CheckTokenSep#1,#2\@empty{%
\def\SH@CTSArgTwo{#2}%
\ifx\SH@CTSArgTwo\@empty%
\edef\SH@TokenValid{\SH@false}%
\else%
\edef\SH@TokenValid{\SH@true}%
\fi%
}
I will report this bugfix to the developer Sascha Herpers
Etichete:
bug,
bug fix,
latex,
space,
tokenizer package
Thursday, February 10, 2011
get rid of latex badboxes on framed figures
If you include in a LaTeX document a graphics file with a frame
you will get a badbox warning. The solution is to substract twice the size of the frame:
For multicolumn:
\fbox{\includegraphics[width=\textwidth]{file.png}}you will get a badbox warning. The solution is to substract twice the size of the frame:
\fbox{\includegraphics[width=\textwidth-\fboxrule-\fboxrule]{file.png}}For multicolumn:
\fbox{\includegraphics[width=\columnwidth-\fboxrule-\fboxrule]{file.png}}
Sunday, January 30, 2011
virtual flying birds
I have created a 2D simulation of a a flock of flying birds that are scared of mouse movement. Here is the link www.virtual-flying-birds.tk.
Etichete:
birds flight,
canvas element,
Javascript,
simulation
Sunday, December 5, 2010
Translate BIG webpages using Google Translate JS API
Today I have released yet another open source project : zgtranslate . It is a Javascript library that could be used to translate large webpages using Google Translate JS API.
Google provides a widget that can be placed in the html code of the webpage, but there are some nasty things about it:
Google provides a widget that can be placed in the html code of the webpage, but there are some nasty things about it:
- it requires flash (and I have flash removed)
- it translates just the current page, but not the next linked page (althow it should as it says in its help)
So I decided to make my own translator. Because Google Translate JS API can only process small texts we need to split the (large) webpage into smaller pieces that can be send to hungry Google for processing. I have implemented this split in my library.
Usage is very simple: just include the zGTranslate.js script in your webpage, and set startTranslate(id,language code) to be called when something is clicked (first example) or auto(second example) when the page was loaded.
You can download the examples and the library and see it in action.
Etichete:
API,
google,
Javascript,
open source,
translate
Saturday, September 18, 2010
find my gravatar
Here is a php script that will display your gravatar:
<html>
<body>
<?php
/**
* Get either a Gravatar URL or complete image tag for a specified email address.
*
* @param string $email The email address
* @param string $s Size in pixels, defaults to 80px [ 1 - 512 ]
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
* @param boole $img True to return a complete IMG tag False for just the URL
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
* @return String containing either just a URL or a complete image tag
* @source http://gravatar.com/site/implement/images/php/
*/
function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {
$url = 'http://www.gravatar.com/avatar/';
$url .= md5( strtolower( trim( $email ) ) );
$url .= "?s=$s&d=$d&r=$r";
if ( $img ) {
$url = '<img src="' . $url . '"';
foreach ( $atts as $key => $val )
$url .= ' ' . $key . '="' . $val . '"';
$url .= ' />';
}
return $url;
}
print(get_gravatar('my_email_address@gmail.com')."\n" )
?>
</body>
</html>
Friday, August 27, 2010
latest googletalk-call not working with kopete in Ubuntu Maverik
The latest kopete-gcall 4:4.5.0b-0ubuntu3 does not contain the executable /usr/bin/googletalk-call so kopete gives the following error message: "Cannot start process googletalk-call. Check your installation of Kopete.".
I recommend installing the previous version of kopete-gcall that can be found here.
The bug report is here.
I recommend installing the previous version of kopete-gcall that can be found here.
The bug report is here.
Etichete:
error message,
googletalk-call,
kopete,
linux,
maverik,
ubuntu
Sunday, August 22, 2010
reCaptcha Solver
reCAPTCHA.net has officially been solved algorithmically. Details here(docx, pptx, video).
copy svn working dir without svn hidden dirs and files
Use one of the following commands:
svn export PATH1 PATH2
rsync -r --exclude=.svn /home/user/progname/ /home/user/progname.copy
tar --exclude='.svn' -c -f - /path/to/sourcedir/* | (cd /path/to/destdir ; tar xfp -)
- just copy the entire directory and then delete the Subversion stuff
find /path/to/destdir -name '.svn' -exec rm -r {} \;
Etichete:
export,
hidden files,
svn,
without
Subscribe to:
Posts (Atom)



