tag:blogger.com,1999:blog-3261349255578629712024-03-06T03:47:28.351+02:00ProgrammingUnknownnoreply@blogger.comBlogger24125tag:blogger.com,1999:blog-326134925557862971.post-21091846609836705972017-11-18T15:01:00.000+02:002017-11-18T15:01:42.378+02:00Javascript to disable double-clicking on a webpageUse a capture phase event listener on the document:<br />
<code>
document.addEventListener(<br />
'dblclick', function(event) { <br />
alert("Double-click disabled!");<br />
event.preventDefault(); <br />
event.stopPropagation();<br />
},<br />
true//capturing phase!!<br />
);<br />
</code>Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-326134925557862971.post-66299587952719027382014-10-25T00:37:00.001+03:002014-10-25T00:39:19.890+03:00Sărbători legale România - funcție PHP
<iframe src="http://pastebin.com/embed_iframe.php?i=SWhZB4qF" style="border:none;height: 19em; width:100%"></iframe>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-326134925557862971.post-23989628233445601392013-03-28T08:48:00.002+02:002013-03-28T08:53:54.544+02:00numbering the first line using lineno package with modulo optionHere is a how number the first line when modulo option is enabled on lineno LaTeX package:
<iframe src="http://pastebin.com/embed_iframe.php?i=q8xWSWpq" style="border:none;height: 19em; width:100%"></iframe>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-4881252642607669902012-12-15T18:45:00.003+02:002012-12-15T18:45:43.597+02:00How 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:
<code>
AddType image/svg+xml svg
</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-7248205511353839982012-08-06T01:31:00.000+03:002013-03-28T09:21:49.690+02:00example of citation of an ISO standard in BibTeX<p>This is an example of how to cite an ISO standard in BibTeX:<br/>
<code>
@techreport{ISOPDF,<br/>
author = {ISO},<br/>
Institution = {International Organization for Standardization},<br/>
address = {Geneva, Switzerland},<br/>
Title = {Document management---{P}ortable document format---{P}art~1: {PDF}~1.7},<br/>
number = {32000\char"2012 1:2008},<br/>
Type = {ISO},<br/>
Year = {2008}<br/>
}
</code>
</p>
<p><small>
Note:<code>\char"2012</code> from <code>number</code> field is <a href="http://en.wikipedia.org/wiki/Dash#Figure_dash" target="_blank">figure dash (‒)</a>. The ISO standard above is <a href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=51502" target="_blank">ISO 32000‒1:2008</a>.</small></p>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-326134925557862971.post-59228119731825372162012-07-26T20:13:00.000+03:002012-07-26T20:13:32.100+03:00explicit labelHere is a <code>label</code> command that lets you to set the label, the <code>\ref</code> output and the <code>\pageref</code> output in a LaTeX document
<iframe src="http://pastebin.com/embed_iframe.php?i=eQAcwFmk" style="border:none;height: 43em; width:100%"></iframe>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-55686360853401110172012-04-09T18:10:00.001+03:002012-04-09T18:10:37.209+03:00Share a link on Google PlusTo share an url on Google Plus put an a tag with the following href attribute:
<code>'https://plus.google.com/share?url='.urlencode($URL)</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-34816475449879985232011-10-22T13:40:00.002+03:002012-12-31T04:09:00.462+02:00remove i386 from amd64 Ubuntu systemsUpgrading 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 <code>multiarch</code> file from <code>/etc/dpkg/dpkg.cfg.d</code> :<br />
<code># cd /etc/dpkg/dpkg.cfg.d </code><br />
<code># mv multiarch multiarch.backup </code><br />
<code># aptitude update </code><br />
Since Ubuntu 12.10, you should use
<code>%dpkg --remove-architecture i386</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-40965551151037503522011-08-09T00:03:00.003+03:002013-03-28T09:06:25.202+02:00figure dash in XeLaTeX<div class="separator" style="clear: both; text-align: center;">
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/XeTeX_Logo.svg/200px-XeTeX_Logo.svg.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/XeTeX_Logo.svg/200px-XeTeX_Logo.svg.png" /></a></div>
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:<br />
<ul>
<li>endash: <code>\textendash</code></li>
<li>emdash: <code>\textemdash</code></li>
<li>minus: <code>\textminus</code></li>
</ul>
<div>
Because the code for figure dash is 0x2012 I define the following command for a figure dash in XeLaTeX:</div>
<code>\newcommand{\textfigdash}{\char"2012 }%figure dash ‒</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-302941396310912982011-03-28T12:06:00.000+03:002011-03-28T12:06:16.147+03:00URL rewriting tutoriala very good apache url rewriting tutorial is <a href="http://www.addedbytes.com/for-beginners/url-rewriting-for-beginners/">here</a>.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-39938536575059039512011-03-07T15:42:00.000+02:002011-03-07T15:42:11.556+02:00latex: arabic footnotes in minipage environment<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFYpgdUDh4YOhLK1QMhr34EmJ1WDUE7iJsH7Eg-7gAcht1-oBu7Ss6EuhmI4u2hWoJ606uTlteH6XNXSL2A-3yKPiZ-vaQwazCqB0yH6QDZHibchqxgFNYtrKJdK0WOdBp8cai484H9mQ/s1600/framed_latex.jpeg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFYpgdUDh4YOhLK1QMhr34EmJ1WDUE7iJsH7Eg-7gAcht1-oBu7Ss6EuhmI4u2hWoJ606uTlteH6XNXSL2A-3yKPiZ-vaQwazCqB0yH6QDZHibchqxgFNYtrKJdK0WOdBp8cai484H9mQ/s1600/framed_latex.jpeg" /></a></div>To get arabic footnote markers in the minipage environment renew \thempfn command:<br />
<code><br />
\begin{minipage}{\textwidth}<br />
\renewcommand{\thempfn}{\arabic{mpfootnote}}<br />
...<br />
\end{minipage}<br />
</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-76023273314529629952011-02-26T13:51:00.001+02:002011-03-07T15:54:12.317+02:00latex warning output<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFYpgdUDh4YOhLK1QMhr34EmJ1WDUE7iJsH7Eg-7gAcht1-oBu7Ss6EuhmI4u2hWoJ606uTlteH6XNXSL2A-3yKPiZ-vaQwazCqB0yH6QDZHibchqxgFNYtrKJdK0WOdBp8cai484H9mQ/s1600/framed_latex.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFYpgdUDh4YOhLK1QMhr34EmJ1WDUE7iJsH7Eg-7gAcht1-oBu7Ss6EuhmI4u2hWoJ606uTlteH6XNXSL2A-3yKPiZ-vaQwazCqB0yH6QDZHibchqxgFNYtrKJdK0WOdBp8cai484H9mQ/s1600/framed_latex.jpeg" /></a></div>To make latex print an warning at output one can use:<br />
<ul><li><code>\@latex@warning{My message}</code>prints "file.tex:10: My message on input line 10"</li>
<li><code>\@latex@warning@no@line{My message}</code>prints "file.tex:0: My message"</li>
</ul><br />
One can define a \todo command to get warnings about uncompleted sections. The following todo command will print a <br />
<table border="1"><tbody>
<tr><td>TODO...</td></tr>
</tbody></table>in the PDF and the warning message passed as a parameter <code>\todo{Finish Thanks section!}</code><br />
<br />
Code for pasting in LaTeX package(.sty file)<br />
<code><br />
\makeatletter<br />
\newcommand{\todo}[1][]{\@latex@warning{TODO #1}\fbox{TODO\dots}}<br />
\makeatother<br />
</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-53471506160077152942011-02-25T20:28:00.002+02:002011-02-25T20:56:35.947+02:00bugfix> remove unwanted spaces in tokenizer packageAs notice <a href="http://stackoverflow.com/questions/95824/replace-a-character-with-a-string-in-latex">here</a> \GetTokens inserts unwanted spaces. The bugfix is to use the following code instead of just "\usepackage[trim]{tokenizer}":<br />
<pre><code>\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%
}
</code></pre><br />
I will report this bugfix to the developer <a href="http://www.scmp.uni-koeln.de/mitarbeiter/herpers.htm">Sascha Herpers</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-48167909399976174552011-02-10T14:22:00.000+02:002011-02-10T14:22:08.153+02:00get rid of latex badboxes on framed figures<div class="separator" style="clear: both; text-align: center;"><a href="http://en.wikipedia.org/wiki/LaTeX" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFYpgdUDh4YOhLK1QMhr34EmJ1WDUE7iJsH7Eg-7gAcht1-oBu7Ss6EuhmI4u2hWoJ606uTlteH6XNXSL2A-3yKPiZ-vaQwazCqB0yH6QDZHibchqxgFNYtrKJdK0WOdBp8cai484H9mQ/s1600/framed_latex.jpeg" /></a></div>If you include in a LaTeX document a graphics file with a frame<br />
<code>\fbox{\includegraphics[width=\textwidth]{file.png}}</code><br />
you will get a badbox warning. The solution is to substract twice the size of the frame:<br />
<code>\fbox{\includegraphics[width=\textwidth-\fboxrule-\fboxrule]{file.png}}</code><br />
For multicolumn:<br />
<code>\fbox{\includegraphics[width=\columnwidth-\fboxrule-\fboxrule]{file.png}}</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-60622613711816702422011-01-30T02:27:00.001+02:002011-01-30T02:30:49.524+02:00virtual flying birds<div class="separator" style="clear: both; text-align: center;"><a href="http://www.virtual-flying-birds.tk/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6EhWv1wSI-7Qt7QwTEJ5l0hP-HCmx24vvxG0qHjorGaosT9NIwZ7JocOcaMjof8Le-Mi0__UX2mHC5SQzm-mSmdo2pZpb2UQFGPbMh4QWLAITHBycueQb3toHYco_TOuhCZjMFhvaxD0/s320/FlyingBirds.png" width="320" /></a></div>I have created a 2D simulation of a a flock of flying birds that are scared of mouse movement. Here is the link <a href="http://www.virtual-flying-birds.tk/">www.virtual-flying-birds.tk</a>.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-35233722741595597872010-12-05T04:26:00.002+02:002010-12-09T01:41:53.583+02:00Translate BIG webpages using Google Translate JS API<div class="separator" style="clear: both; text-align: center;"><a href="http://zgtranslate.googlecode.com/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.google.com/images/logos/code_logo.gif" /></a></div>Today I have released yet another open source project : <a href="http://zgtranslate.googlecode.com/"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">zgtranslate</span></a> . It is a Javascript library that could be used to translate large webpages using <a href="http://code.google.com/apis/language/translate/v1/reference.html">Google Translate JS API</a>.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://translate.google.com/about/intl/en_ALL/tour.html#professional" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.google.com/intl/en/images/logos/translate_logo.gif" /></a></div>Google provides a widget that can be placed in the html code of the webpage, but there are some nasty things about it:<br />
<ol><li>it requires flash (and I have <a href="https://chrome.google.com/extensions/detail/cdngiadmnkhgemkimkhiilgffbjijcie">flash removed</a>)</li>
<li>it translates just the current page, but not the next linked page (althow it should as it says in its help)</li>
</ol><div>So I decided to make my own translator. Because <a href="http://code.google.com/apis/language/translate/v1/reference.html">Google Translate JS API</a> 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.</div><div>Usage is very simple: just include the <a href="http://code.google.com/p/zgtranslate/source/browse/trunk/zGTranslate.js">zGTranslate.js</a> script in your webpage, and set <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">startTranslate(id,language code)</span> to be called when something is clicked (<a href="http://code.google.com/p/zgtranslate/source/browse/trunk/zGT_example_withButton.html?spec=svn2&r=2">first example</a>) or auto(<a href="http://code.google.com/p/zgtranslate/source/browse/trunk/zGT_example_auto.html?spec=svn2&r=2">second example</a>) when the page was loaded.</div><div><br />
</div><div>You can download the examples and the library and see it in action.</div><div><br />
</div><div><span class="Apple-style-span" style="font-size: x-small;"><i>Note: <strike>as stated in <a href="http://code.google.com/p/zgtranslate/issues/detail?id=1">issue 1</a>, the library does not yet works with IE6.</i></strike> bug fixed <a href="http://code.google.com/p/zgtranslate/source/detail?r=5">now</a></span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-13706437116578009492010-09-18T14:12:00.000+03:002010-09-18T14:12:17.411+03:00find my gravatarHere is a php script that will display your <a href='http://www.gravatar.com'>gravatar</a>:<br />
<code><br />
<html><br />
<body><br />
<?php<br />
/**<br />
* Get either a Gravatar URL or complete image tag for a specified email address.<br />
*<br />
* @param string $email The email address<br />
* @param string $s Size in pixels, defaults to 80px [ 1 - 512 ]<br />
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]<br />
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]<br />
* @param boole $img True to return a complete IMG tag False for just the URL<br />
* @param array $atts Optional, additional key/value attributes to include in the IMG tag<br />
* @return String containing either just a URL or a complete image tag<br />
* @source http://gravatar.com/site/implement/images/php/<br />
*/<br />
function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {<br />
$url = 'http://www.gravatar.com/avatar/';<br />
$url .= md5( strtolower( trim( $email ) ) );<br />
$url .= "?s=$s&d=$d&r=$r";<br />
if ( $img ) {<br />
$url = '<img src="' . $url . '"';<br />
foreach ( $atts as $key => $val )<br />
$url .= ' ' . $key . '="' . $val . '"';<br />
$url .= ' />';<br />
}<br />
return $url;<br />
}<br />
<br />
print(get_gravatar('my_email_address@gmail.com')."\n" )<br />
<br />
?><br />
</body><br />
</html><br />
</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-82559988824237248522010-08-27T20:09:00.001+03:002010-08-27T20:13:24.281+03:00latest googletalk-call not working with kopete in Ubuntu Maverik<div style="text-align: justify;">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: "<i>Cannot start process googletalk-call. Check your installation of Kopete.</i>".<br />
I recommend installing the previous version of kopete-gcall that can be found <a href="https://launchpad.net/ubuntu/+source/kdenetwork/4:4.5.0b-0ubuntu2">here</a>.<br />
The bug report is <a href="https://bugs.launchpad.net/kopete/+bug/625088">here</a>.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-56422985281746583562010-08-22T18:21:00.000+03:002010-08-22T18:21:03.506+03:00reCaptcha Solver<div class="separator" style="clear: both; text-align: center;"><a href="http://recaptcha.net/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="111" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/RecaptchaLogo.svg/457px-RecaptchaLogo.svg.png" width="200" /></a></div>reCAPTCHA.net has officially been solved algorithmically. Details <a href="http://n3on.org/projects/reCAPTCHA/">here</a>(docx, pptx, video).Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-77167442157094246842010-08-22T10:33:00.003+03:002010-08-22T10:35:47.044+03:00copy svn working dir without svn hidden dirs and filesUse one of the following commands:<br />
<ul><li><code><br />
svn export PATH1 PATH2<br />
</code></li>
<li><code><br />
rsync -r --exclude=.svn /home/user/progname/ /home/user/progname.copy<br />
</code></li>
<li><code><br />
tar --exclude='.svn' -c -f - /path/to/sourcedir/* | (cd /path/to/destdir ; tar xfp -)<br />
</code></li>
<li>just copy the entire directory and then delete the Subversion stuff <code><br />
find /path/to/destdir -name '.svn' -exec rm -r {} \;<br />
</code></li>
</ul>I found this info <a href="http://www.linuxquestions.org/questions/linux-software-2/copy-svn-working-dir-without-svn-hidden-dirs-and-files-620586/">here</a>.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-89343576009740027412010-08-21T19:31:00.001+03:002011-01-30T02:32:52.340+02:00upcase and lowercase alphabet + numbers<div class="separator" style="clear: both; text-align: center;"><a href="http://example.com/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="188" src="http://irishdev.com/files/images/ALPHA-BETA.PNG" width="200" /></a></div><code><br />
ABCDEFGHIJKLMNOPQRSTUVWXYZ<br />
abcdefghijklmnopqrstuvwxyz<br />
0123456789<br />
</code>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-71807992981554735302010-08-16T13:13:00.001+03:002010-08-16T13:25:08.823+03:00Debian Appreciation Day<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://thank.debian.net/" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://www.debian.org/Pics/Debian17.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Happy birthday Debian!</td></tr>
</tbody></table>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-326134925557862971.post-77727683643415723792010-07-22T11:37:00.003+03:002010-07-22T11:52:04.427+03:00Google Virtual Keyboard inserts non-breaking space instead of space<div class="separator" style="clear: both; text-align: center;"><a href="http://www.google.com/webelements/virtualkeyboard/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilcEVjdxhGeq3RqOFErDUb8yw5yEhYS00q_VBi_Y3k8hl3y5jIRdGZOkEq04KZZKPXeC5f4guUEv6ti6X8YQ3Wfz5HkzIVhyphenhyphenNoeFDrWGGtSqEo_DLNLXaRZI2mnlGOMXhXAoFdI33Icf8/s320/romanian+google+virtual+keyboard.png" width="320" /></a></div>I have summited a bug for the Google Virtual Keyboard: more details at <a href="http://code.google.com/p/google-ajax-apis/issues/detail?id=494">http://code.google.com/p/google-ajax-apis/issues/detail?id=494</a><br />
<span class="Apple-style-span" style="font-size: x-large;">What steps will reproduce the problem?</span><br />
<br />
1. implement and enable a google virtual keyboard for an input element(text or textarea) on a website<br />
2. type some words and space in that input box( for example "google bug")<br />
<br />
example:<br />
1. open www.google.ro (it has a virtual keyboard for the search input) or http://www.revistapadurilor.ro/index.php?section=KeywordSearch (this webpage has a text input in the central part that has a virtual keyboard with romanian layout enabled)<br />
2. write the text: google bug<br />
3. copy the inputed text and use a HTML encode utility(like http://www.cafewebmaster.com/online_tools/htmlentities ) to encode the text to HTML entities<br />
<br />
<span class="Apple-style-span" style="font-size: x-large;">What is the expected output? </span><br />
<br />
The expected output is the text with simple(regular) spaces<br />
<br />
<span class="Apple-style-span" style="font-size: x-large;">What do you see instead?</span><br />
<br />
Instead of inserting simple (breaking) spaces, the google virtual keyboard inserts non-breaking space.<br />
Example: google bug or (copy pasted):"google bug"<br />
<br />
<br />
<span class="Apple-style-span" style="font-size: x-large;">What version of the product are you using? On what operating system?</span><br />
<br />
latest (script loaded from http://www.google.com/jsapi )<br />
<br />
<span class="Apple-style-span" style="font-size: x-large;">Note: </span><br />
I checked this bug on the romanian and english layout.<br />
<br />
<span class="Apple-style-span" style="font-size: x-large;"><i>Update:</i></span><br />
<i>Seems to be a Chromium related issue. This bug does not appear on Mozilla Firefox. Submitted an issue to Chromium: </i><a href="http://code.google.com/p/chromium/issues/detail?id=49902"><i>http://code.google.com/p/chromium/issues/detail?id=49902</i></a><br />
<br />
<div><br />
</div>Unknownnoreply@blogger.com0Romania45.943161 24.9667642.123735 17.496057 49.762587 32.437463tag:blogger.com,1999:blog-326134925557862971.post-35025186851072483352010-07-18T20:43:00.005+03:002010-07-18T20:49:19.043+03:00Google Virtual Keyboard with layout selector using a drop-down menu<div class="separator" style="clear: both; text-align: center;"><a href="http://www.google.com/webelements" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.google.com/webelements/images/web_elements_logo.gif" /></a></div>Google Web Elements allow you to easily add your favorite Google products onto your own website. I will talk about the <a href="http://www.google.com/webelements/virtualkeyboard/">Google Virtual Keyboard</a>.<br />
As you can see on its <a href="http://www.google.com/webelements/virtualkeyboard/">presentation page</a>, <a href="http://googleblog.blogspot.com/2010/04/integrating-virtual-keyboards-in-google.html">Google has implemented a virtual keyboard</a> that lets you type directly in your local language script in an easy and consistent manner. Google's virtual keyboard allows developers to enable virtual keyboards on any text field or text area in their webpages.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://www.google.com/webelements/virtualkeyboard/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.google.com/webelements/images/ss-vk-element.png" /></a></div><span class="Apple-style-span" style="font-size: x-large;">How to attach a Virtual Keyboard to inputs on your site</span><br />
As explained <a href="http://googleajaxsearchapi.blogspot.com/2009/06/introducing-virtual-keyboard-api.html">here</a> and <a href="http://www.google.com/webelements/virtualkeyboard/">here</a>, the steps are:<br />
<br />
<ol><li>determine the language(layout) for the keyboard</li>
<li>determine the ids of the input elements where the keyboard will be active</li>
<li>put some javascript code in the html source of the webpage</li>
</ol>I needed to be able to select when browser the layout. I found an example <a href="http://code.google.com/apis/ajax/playground/#change_layout">here</a> that allows to switch the layout to some predetermined layouts, but this wasn't enought.<br />
<div>After some google <a href="http://code.google.com/apis/ajaxlanguage/documentation/#KeyboardDrawMenu">I found an example</a> that gets all the available layouts and makes a button(anchor) for each one, so when clicked the layout of the keyboard is changed. </div><div>I prefer using a drop-down menu so the code is:</div><div><br />
<code><br />
// Load the Google Onscreen Keyboard API<br />
google.load("elements", "1", {packages: "keyboard"});<br />
<br />
var kbd; // A Keyboard object.<br />
<br />
// Draw a list of keyboard layouts in their native languages.<br />
// User can click any of them to switch to that keyboard layout.<br />
function drawMenu() {<br />
html = ["<select onchange='kbd.setLayout(this.options[this.selectedIndex].value)' >"];<br />
html.push("<option value=\"en\" >", "Select a layout for the virtual keyboard", "</option>");<br />
for (var i in google.elements.keyboard.LayoutCode) {<br />
var code = google.elements.keyboard.LayoutCode[i];<br />
var name = google.elements.keyboard.getLayoutName(code);<br />
html.push("<option value=\"", code, "\" >", name, "</option>");<br />
}<br />
html.push("</select>");<br />
document.getElementById("kbSelect").innerHTML += html.join("");<br />
}<br />
<br />
<br />
function onLoad() {<br />
// Create an instance on Keyboard.<br />
kbd = new google.elements.keyboard.Keyboard([<br />
google.elements.keyboard.LayoutCode.ENGLISH],<br />
["id1","id2","id3"]);<br />
drawMenu();<br />
kbd.setLayout("en");//default language<br />
}<br />
<br />
google.setOnLoadCallback(onLoad);<br />
</code><br />
<br />
The code works very good so I implemented it in my website design toolkit in a PHP class called PVirtualKeyboard(<a href="http://code.google.com/p/pwision/source/browse/trunk/inc/PVirtualKeyboard.inc?spec=svn137&r=137">source code here</a>).</div>Unknownnoreply@blogger.com0