.htaccess – detect mobile devices and redirect to the propper page

in file .htaccess add next code to detect mobile device and redirect to the proper location:

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} “(Android|iPod|iPhone|iPad)” [NC,OR]

RewriteCond %{HTTP_USER_AGENT} “sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera” [NC,OR]
RewriteCond %{HTTP_USER_AGENT} “mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox”[NC,OR]
RewriteCond %{HTTP_USER_AGENT} “blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-“[NC,OR]
RewriteCond %{HTTP_USER_AGENT} “portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc”[NC,OR]
RewriteCond %{HTTP_USER_AGENT} “smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android”[NC]

RewriteRule .* http://www.google.com?q=%{HTTP_USER_AGENT} [L]

Add-on FireQuery – simpla integrarea si rularea lui jquery in pagina web in firefox

About this Add-on

FireQuery is a collection of Firebug enhancements for jQuery. Requires Firebug 1.3 or greater.


jQuery expressions are intelligently presented in Firebug Console and DOM inspector
attached jQuery data are first class citizens
elements in jQuery collections are highlighted on hover
jQuerify: enables you to inject jQuery into any page

Video cum putem sa-l folosim sursa youtube

Sursa Add-on gasiti aici

cum se pot trimite parametrii catre un javascript extern

Presupunem ca avem un fisier extern care executa niste functii de javascript, acesta este inclus in pagina noastra folosing tagurile corespunzatoare

< script type="text/javascript" language="JavaScript" src=".... < /script>

in acest script vrem sa trimitem niste parametrii


in tagul nostru de javascript extern scriem urmatoarele:

< script type="text/javascript" language="JavaScript" src="do_javascript.php?page=general&id=123123"/>

in fisierul do_javascript.php setam header-ul care seteaza fisierul ca fiind unul de javascript

Initializam parametrii primiti din URL in formatul lui javascript,

In asa fel putem sa folosim parametrii trimisi prin request.

serializarea anumitor campuri din pagina si trimitearea acestoara pe server

Folosind jQuery, se poate face minuni, asta stim cu totii 🙂

o noua minune descoperita de mine este urmatoarea:

am nevoie sa trimit catre server anumite campuri din pagina, o parte dintr-o forma, o parte din afara ei.
ce trebuie sa fac?

1) definesc o clasa pentru acele campuri, ca sa-i pot sa identific
< input type="text" name="first_name" class=”edit_field” value=”” / >

2) folosind functia .serializeArray() din libraria lui jQuery pentru a serializa rezultate in formatul JSON.

3) folosind ajax tot de la jQuery trimit parametrii serializati catre server, folosind metoda GET/POST


< script >
var fields = $(".edit_field").serializeArray();
// do update via ajax
    type: "POST",
    url: "/users/update/",
    success: function(data){}
< /script >

non-breaking space in MIME encoded, quoted-printable text

in emailurile encodate cu quoted-printable apare un caracter “space” care nu poate fi parsat nici de php nici de C#, acesta reprezinta codul “=C2=A0” in bytes “C2 A0”.

UTF-8 il translateaza in 00A0.

ca sa scapam de acest caracter trebuie sa-l decodam folosind functia “quoted_printable_decode” si apoi sa eliminam sir de caractere “=C2=A0” sau “\xC2\xA0”

mai multe informatii gasiti aici

Jquery Calendar with time picker and translation of the content

The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker and slider components (jQueryUI) are required for using any of these.

To create your own regional objects per region, use the setDefaults method to tie these together. Setting datepicker and timepicker regionals separtely will help ensure proper wording when only using datepicker or timepicker. Here is an example:

$.datepicker.regional[‘ru’] = {
closeText: ‘Закрыть’,
prevText: ‘<Пред', nextText: 'След>‘,
currentText: ‘Сегодня’,
monthNames: [‘Январь’,’Февраль’,’Март’,’Апрель’,’Май’,’Июнь’,
monthNamesShort: [‘Янв’,’Фев’,’Мар’,’Апр’,’Май’,’Июн’,
dayNames: [‘воскресенье’,’понедельник’,’вторник’,’среда’,’четверг’,’пятница’,’суббота’],
dayNamesShort: [‘вск’,’пнд’,’втр’,’срд’,’чтв’,’птн’,’сбт’],
dayNamesMin: [‘Вс’,’Пн’,’Вт’,’Ср’,’Чт’,’Пт’,’Сб’],
weekHeader: ‘Не’,
dateFormat: ‘dd.mm.yy’,
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ”

$.timepicker.regional[‘ru’] = {
timeOnlyTitle: ‘Выберите время’,
timeText: ‘Время’,
hourText: ‘Часы’,
minuteText: ‘Минуты’,
secondText: ‘Секунды’,
millisecText: ‘миллисекунды’,
currentText: ‘Теперь’,
closeText: ‘Закрыть’,
ampm: false

timeFormat: ‘h:m’,
separator: ‘ ‘

documentation here

pagination on google custom search

in the google custom search results pagination will not keep the number of page just visited,
for example if you go to the page 3 and go back via browser button you will get results from the first page.

To keep visited page some custom modifications should be implemented:

step 1:
In the function searchCompleteCallback(), we need to add to all links parameter &page= with calculated page counter


if(back_page == '')
 back_page = 0;
 back_page = (back_page*10)-10;

with javascript append all links with this parameter.


step 2:

in the function google.setOnLoadCallback(function(){ set the parameter with google custeom search key,to use this application, and concatinate parameter with page number

var customSearchControl = new google.search.CustomSearchControl(‘gcs_customer_key’+’&start=’.$_GET[‘page’]);

This will point the results from the google custom serach to the right page number.