Sunday, March 30, 2014

How to override the menu link theme in Drupal

How to override the menu link theme

<?php
/**
* Implementation of hook_menu().
*/
function test_blockGen_menu() {
  $items['bg/testtheme'] = array(
    'title' => '',
    'page callback' => 'test_blockGen_testTheme',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

/**
* Implementation of hook_preprocess_page().
*/
function test_blockGen_preprocess_page(&$variables) {
  file_put_contents('/tmp/debug1', print_r($variables, TRUE) . PHP_EOL, FILE_APPEND);
}
?>

Check the debug log:

# less /tmp/debug1
Array
(
  [template_files] => Array
  (
    [0] => page-bg
    [1] => page-bg-testtheme
  )
)

Create a template file for your menu link to your default theme folder:

# echo "test test" >> /www/drupal6/sites/all/themes/mytheme/templates/page-bg-testtheme.tpl.php

Go to this link to see the result:
http://your_site.local/bg/testtheme

To feed a different template file, do:

<?php
/**
* Implementation of hook_preprocess_page().
*/
function test_blockGen_preprocess_page(&$variables) {
  $variables['template_files'][] = 'page-your-new-template';
}
?>

Reference:

Drupal 6 Template Suggestions
http://drupal.org/node/1089642

Theming nodes by content type
http://drupal.org/node/17565

Using Newer Versions of jQuery
http://drupal.org/node/1058168

Difference between hook_preprocess_page(&$variables) and phptemplate_preprocess_page(&$vars) ??
http://drupal.org/node/378872

Working with template suggestions
http://drupal.org/node/223440#custom-suggestions

Using Theme Override Functions
http://drupal.org/node/55126

CAPTCHA anti spam Drupal Module

A CAPTCHA is a challenge-response test most often placed within web forms to determine whether the user is human. The purpose of CAPTCHA is to block form submissions by spambots, which are automated scripts that post spam content everywhere they can. The CAPTCHA module provides this feature to virtually any user facing web form on a Drupal site.

Co-maintainer wanted

We do this our spare time, which is unfortunately almost nonexistent at the moment due to real life obligations. To give the CAPTCHA module the required level of maintenance, an extra co-maintainer would be welcome. If you're interested in helping with this very popular module, please contact me or open an issue in the CAPTCHA module issue tracker.

Additional CAPTCHA Modules

Other Information

Alternatives

You could also consider spam filtering or hybrid solutions like:
  • The AntiSpam module, is the successor of the Akismet module, and it provides spam protection to your Drupal site using external antispam service like Akismet, TypePad and Defensio.
  • The Mollom module, similar to AntiSpam module, it only presents a CAPTCHA if the user input (e.g. a comment) looks like spam. Also provides stand-alone CAPTCHA service with intelligent, reputation-based CAPTCHAs. It is restricted to the Mollom service
  • The spam module provides spam filtering and related tools
  • The honeypot module

Reference:
https://drupal.org/project/captcha

Configure mod deflate for Apache 2.2.x

Configure mod deflate for Apache 2.2.x

Mod Deflate comes built into Apache, but is not enabled by default. This tutorial will explain the simplest way of enabling it and setting which mime times to compress. Mod Deflate will increase your server load, but decreases the amount of time that clients are connected and can usually reduce the page size by 60 to 80 percent.

Loading Mod Deflate

First make sure that you are loading mod_deflate.so, this line should be at the top of your httpd.conf file and is usually loaded by default.

LoadModule deflate_module libexec/apache22/mod_deflate.so

Mod Deflate Settings

Second create a new config file to keep the deflate options in.

# vi /usr/local/etc/apache22/Includes/mod_deflate.conf

This file will be included in the main httpd.conf file. Inside the file add the following:

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/js application/javascript application/x-httpd-php


#Highest 9 - Lowest 1
#DeflateCompressionLevel 9

#Optional - Skip browsers with known problems
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

#Optional - Logging
#DeflateFilterNote ratio
#LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
CustomLog /var/log/apache/mod_deflate.log deflate

The compression level can be adjusted. 9 gives the highest compression, the smallest file sizes, and also uses the most CPU cycles.

Once you have this config file added restart apache.

# apachectl graceful

Testing Mod Deflate

To test your compression you can compare the file size by looking at the apache logs or a tool use as port80 tools.
Compressing additional types

You can compression additional mime types coming out of your server by adding them to the AddOutputFilterByType list in the mod_deflate.conf file. Some you might want to add are text/css, application/x-javascript, text/xml, and any others that are would benefit from being compressed.

You can also use telnet command to test if the gzip compression (mod_deflate) has been used or not.

Friday, March 28, 2014

Difference between proxy server and reverse proxy server

What is the difference between proxy server and reverse proxy server?

A pair of simple definition would be
Forward Proxy: Acting on behalf of a requestor (or service consumer)
Reverse Proxy: Acting on behalf of service/content producer.
Short Version:
The difference is primarily in deployment. Web forward and reverse proxies all have the same underlying features, they accept requests for HTTP requests in various formats and provide a response, usually by accessing the origin or contact server.
Fully featured servers usually have access control, caching, and some link-mapping features.
A forward proxy is a proxy that is accessed by configuring the client machine. The client needs protocol support for proxy features (redirection, proxy auth, etc.). The proxy is transparent to the user experience, but not to the application.
A reverse proxy is a proxy that is deployed as a web server and behaves like a web server, with the exception that instead of locally composing the content from programs and disk, it forwards the request to an origin server. From the client perspective it IS a web server, so the user experience is completely transparent.
In fact, a single proxy instance can run as a forward and reverse proxy at the same time for different client populations.
That's the short version, I can clarify if people want to comment.
Long Version:
The previous answers were accurate, but perhaps too terse. I will try to add some examples.
First of all, the word proxy describes someone or something acting on behalf of someone else.
In the computer realm, we are talking about one server acting on the behalf of another computer.
For the purposes of accessibility, I will limit my discussion to web proxies, however, the idea of a proxy is not limited to web sites.

FORWARD proxy

Most discussion of web proxies refers to the type of proxy known as a "forward proxy."
The proxy event in this case is that the "forward proxy" retrieves data from another web site on behalf of the original requestee.

A tale of 3 computers (part I)

For an example, I will list three computers connected to the internet.
  • X = your computer, or "client" computer on the internet
  • Y = the proxy web site, proxy.example.org
  • Z = the web site you want to visit, www.example.net
Normally, one would connect directly from X --> Z.
However, in some scenarios, it is better for Y --> Z on behalf of X, which chains as follows: X --> Y --> Z.

Reasons why X would want to use a forward proxy server:

Here is a (very) partial list of uses of a forward proxy server.
  • 1) X is unable to access Z directly because
    • a) Someone with administration authority over X's internet connection has decided to block all access to site Z.
      • Examples:
        • The Storm Worm virus is spreading by tricking people into visiting familypostcards2008.com, so the system administrator has blocked access to the site to prevent users from inadvertently infecting themselves.
        • Employees at a large company have been wasting too much time on myspace.com, so management wants access blocked during business hours.
        • A local elementary school disallows internet access to the playboy.com web site.
        • A government is unable to control the publishing of news, so it controls access to news instead, by blocking sites such as wikipedia.org. See TOR or FreeNet.
    • b) The administrator of Z has blocked X.
      • Examples:
        • The administrator of Z has noticed hacking attempts coming from X, so the administrator has decided to block X's ip address (and/or netrange).
        • Z is a forum web site. X is spamming the forum. Z blocks X.

REVERSE proxy

A tale of 3 computers (part II)

For this example, I will list three computers connected to the internet.
  • X = your computer, or "client" computer on the internet
  • Y = the reverse proxy web site, proxy.example.com
  • Z = the web site you want to visit, www.example.net
Normally, one would connect directly from X --> Z.
However, in some scenarios, it is better for the administrator of Z to restrict or disallow direct access, and force visitors to go through Y first. So, as before, we have data being retrieved by Y --> Z on behalf of X, which chains as follows: X --> Y --> Z.
What is different this time compared to a "forward proxy," is that this time the user X does not know he is accessing Y. A Reverse Proxy is typically less visible than a "forward proxy", and requires no configuration or special knowledge by the client, X.
The client X probably thinks he is visiting Z directly (X --> Z), but the reality is that Y is the invisible go-between (X --> Y --> Z again).

Reasons why Z would want to set up a reverse proxy server:

  • 1) Z wants to force all traffic to its web site to pass through Y first.
    • a) Z has a large web site that millions of people want to see, but a single web server cannot handle all the traffic. So Z sets up many servers, and puts a reverse proxy on the internet that will send users to the server closest to them when they try to visit Z. This is part of how the Content Distribution Network (CDN) concept works.
  • b) The administrator of Z is worried about retaliation for content hosted on the server, and does not want to expose the main server directly to the public.
    • a) Owners of Spam brands such as "Canadian Pharmacy" appear to have thousands of servers, while in reality having most websites hosted on far fewer servers. Additionally, abuse complaints about the spam will only shut down the public servers, not the main server.
In the above scenarios, Z has the ability to choose Y.

Links to topics from the post:

Content Delivery Network

forward proxy software (server side)

reverse proxy software for HTTP (server side)

reverse proxy software for TCP (server side)

see also:

Explain:
qyb2zm302's answer nicely details applications of proxies but slips up on the fundamental concept between forward and reverse proxies. For the reverse proxy, X -> Y -> Z, X knows about Y and not Z, rather than vice versa.
http://www.jscape.com/blog/bid/87783/Forward-Proxy-vs-Reverse-Proxy explains the difference between forward and reverse proxies very clearly.
A proxy is simply a middleman for communication(requests+responses). Client <-> Proxy <-> Server
  • Client proxy: ( Client <-> Proxy ) <-> Server
    The proxy acts on behalf of the client. Client knows about all 3 machines involved in chain. Server doesn't.
  • Server proxy: Client <-> ( Proxy <-> Server )
    The proxy acts on behalf of the server. Client only knows about proxy. Server knows whole chain.
Forward and reverse are simply confusing perspective dependent names for client and server proxy?

Reference:
http://stackoverflow.com/questions/224664/difference-between-proxy-server-and-reverse-proxy-server

Thursday, March 27, 2014

請善待老公,其實男人不容易

~ 【 請善待老公,其實男人不容易 】 網路文章分享

有一種現象,稍留心些就發現:老年人中,很多只剩下一位女的,男人比女人要早許多年就過世。

我們到晚年,不管年紀多大,也不管身體狀態怎麼樣,只要有老公始終陪著妳,就算活到八十,活到九十,活到一百,妳也不會感到淒涼和孤獨。

即使到了暮年,夫妻相伴,白天一起看電視看報紙聽收音機,一起旅遊一起到好朋友家喝茶聊天,一起到花園和草坪散步,那份快樂,那份自得,其實,是多少兒女都無法替代的。

《也是任何人都無法替代的。》

更何況,現在的人,大多也只能有一個孩子?

按一般人的認識,男人比女人堅強,女人生兒育女,肯定身體不如男人。

可是,為甚麼許多老人,大多都是老公撇下老妻先走了呢?

※ 《其實,男人,並非像女人以為的那樣堅強。》

他們的堅強,是因為他們把人生遇到的所有屈辱,失落,挫敗,病痛,沮喪,生活的壓力和人生的沉重,全都隱忍在自己心中,不肯說出來,不肯表現出來罷了。

而所有的這些隱忍在心的情緒,其實,全都像一個又一個的「電腦病毒」積累到最後,結果就是崩盤,當機。

男人為甚麼會酗酒?為甚麼會抽煙?為甚麼會沉思?

更多的原因,其實,是他心理已經積存了太多的病毒。

就因為他是男人,他不能輕易流淚,更不能輕易向人訴說。

他必得在妻子,在兒女,在父母面前做出硬漢子的形象。

而女人,卻習慣哪怕一點點的委屈,都會向丈夫,向父母,向姐妹們,向好友傾訴出來,女人病毒不會積存。

她會在每一次的傾訴和淚水中,清理皆淨。

而人類,幾乎所有的疾病,更多的原因就是鬱積出來的。

所以,情緒愛宣洩出來的女人,往往往壽命長久。
而男人,卻早於妻子離開人世。

※ 《怎麼樣才能讓老公儘可能活得更長久,儘可能陪妳到老?》

從現在做起,立即行動!那麼,妳該著手做些甚麼事?

※ 一,當老公回到家中,儘可能給他營造一個溫馨輕鬆的環境。
其實,沒有重要客人來訪,幹嘛一定非要把地拖得一塵不染?
衣服幹嘛非要當時就洗?
為甚麼一定要把本該在家中休閒放鬆的時間,弄得兩人都緊緊張張的?而夫妻兩口,磨嘴的時候,多是家務。

※ 二,當老公在外面不快時,即使他不說,妳也要儘可能去察覺,一面用愛心關懷他,給他做個下酒菜,倒一杯酒,講些幽默的段子,先轉移他的不快,接著慢慢尋問。

如果他不想告訴妳,甚至不想提及,妳一定不要再繼續打聽。
他一定是受了很重的內傷,此時,男人是習慣自己舔傷口的。
妳能做的是一個字:愛!體貼!溫柔!
這雖不一定能排解他的內心的鬱積和傷口,但一定會是止痛劑和消炎藥。
如果他肯說了,那麼,不管他說出來的是甚麼事,妳都不能在此時抱怨他了。
妳能做的,就是開導和疏導他轉移不良情緒。
其實,他的所有不快,說穿了,決不會超過「名利」二字的範圍。
再則就是和人起了爭執,受了領導的指責。
如果,妳最在意的是老公的健康,是老公能陪妳到老,妳就不該最在意丈夫的名利,
命中該有的終須會有,沒有的,掙死,也來不了。硬撐著掙來的,還會失去。
不在這方面失去,必會在另一方面失去。這是鐵定的規律。
妳如果不在意了,丈夫會活得十分輕鬆。
這種輕鬆,恰恰會成就妳們得到許多驚喜!

※ 三,酒不可過量。
酒場上逞英雄的,其實大家表面誇他,轉臉都會當他是傻瓜。
煙,如果實在斷不了,儘可能不要吸劣質煙,但一定說服他少吸煙。

※ 四,如果必須得和年老的婆婆同住,
沒有條件和並不年老的婆婆分開居住,妳就一定要接受現實,儘量和婆婆搞好關係。
因為,妳容不下丈夫的母親,妳們的矛盾,妳們的每一場戰爭,都必會減弱丈夫數月、一年,甚至幾年的壽命。
反之,他如果天天和妳母親不和吵鬧,妳該怎麼辦?壓抑而無奈又夾在板中的妳,肯定一樣也會減壽的。
好,這到以上四點,下面的就容易多了:

※ 五,妳要是愛妳丈夫,就不要多弄那些煎炸烹炒的食物給他吃。
這個不能由著他的性子。多做一些素菜和涼拌菜。
要像哄孩子那樣哄他吃這些。
當他吃完這些清淡的素菜之後,他也會發覺,過去那種老吃油水大的煎炸食物後,莫名其妙的頭昏腦漲,無精打彩和昏昏欲睡等等說不出原因的不良狀態,會驟然改善。

※ 六,妳要想丈夫陪妳到老,妳要儘可能讓丈夫參加有氧活動。
跑步,快走,打球,旅行,爬山,打拳,哪怕沒有條件,在屋內活動一下筋骨,地板上打幾個滾,都一樣能起到鍛練的目的。

※ 七,妳要想丈夫陪妳到生命的盡頭,就要關護他像關護孩子般。
只要妳是真愛他那個人的,而沒有太多的附加條件,妳一定樂意試試。
妳這樣做了,妳會發現,他會活得很開心,會活得很熱烈,會活得很有成就感,會活得很健康,他一定會回報妳的。那是妳始料不及的。
即使他很普通,但他一定是真愛妳的,他也一定不會先走,他會一直陪著妳,活得很久很久,一直陪妳到生命的盡頭。
姐妹們,當我們老到白髮蒼蒼時,當我們老到腿腳酸疼時,當我們老到腰彎,可是,只要有老公陪在身邊,妳會知道,千萬資產,也不如一個陪了妳一生一世的老公為妳端來一杯熱茶,數來幾片藥片。
當我們老到滿臉皺紋時,多少昂貴的禮服和化妝品,也不如老公輕輕地挽著妳的胳臂走在夕陽的草叢中。
當我們老得只能在搖椅裡甚至輪椅裡搖啊推時,妳會發覺,甚麼豪宅權威功名,也抵不上夜半變天時,老公為妳加打開電熱毯和一聲問侯。

※ 八,為甚麼要從現在做起而不是將來?
因為,一棵樹,越早矯正,它就直得越早。
老公也如此,越早注意對他的關愛,他的身心就會一直健康,即使有了病毒,也會被妳的愛及時清除,而不至於積留到未來。
妳能做到這些,能使他的身心得到健康的同時,因為妳們是一起生活的,所以,妳自己也必將快樂和健康。
在督促他進取的同時,妳也必將懂得努力修煉,增加自己的核心競爭力。【感恩合十】

Wednesday, March 19, 2014

Using Newer Versions of jQuery


Last updated April 18, 2012. Created by csdco on February 11, 2011.
Edited by hansrosselsilverwingLog in to edit this page.
You will often need a newer version of jQuery to be able to use a certain jQuery plugin. There are several ways to achieve this.
Always remember that you better exclude admin and node/add/edit pages as the javascript in Drupal core depends on the specific version of jquery that is packaged with core. Drag and drop, tablesort, ahah, ... will not work anymore with higher versions of jquery unless you adapt the code of those core js files. If you only need a higher version of jquery for a certain plugin, specify it should only be swapped for the frontend of your site or for the specific page it is needed.
The methods below should also only be needed if the version ofhttp://drupal.org/project/jquery_update is not high enough. Jquery update takes care of the changes needed in core javascript code so it stays compatible also in the backend.

Method 1: Using hook_js_alter

In Drupal 7 you can use hook_js_alter for replacing jquery conditionally. This way you don't need to load jquery twice which is better for performance and you also don't need to adapt your code. You can easily wrap some conditions around so it only targets the front-end pages where you need an updated version of jquery and avoid breaking the backend js.
function hook_js_alter(&$javascript) {
 
// Swap out jQuery to use an updated version of the library.
 
$javascript['misc/jquery.js']['data'] = drupal_get_path('module', 'jquery_update') . '/jquery.js';
}
?>
In Drupal 6 you can use http://drupal.org/project/jsalter which has a similar hook.

Method 2: Running 2 versions of jQuery side-by-side - the jQuery noConflict() function.

The Problem

Your custom theme, dropdown menu, slideshow, or other jQuery dependant scripts require jQuery 1.4, jQuery UI 1.8, or some other jQuery version or component. Drupal 6 ships with jQuery 1.2.6. You could just replace the jquery.js file in example.com/misc with a newer version, but you'd run into some issues, such as:
  • Useful UI features like draggable tables and ajax search will stop working
  • Contributed modules that use jQuery assume you are using 1.2.6
  • After updating Drupal to a newer version, your custom jquery.js file would be overwritten with 1.2.6

The Solution

jQuery already has the functionality to run along side a different version of jQuery (or, really, along side any other JavaScript library that uses the $ symbol as a function or variable). This is the noConflict() function. You can view the API page here:http://api.jquery.com/jQuery.noConflict/
To use this functionality within your project, simply tell the browser about your new jQuery library and that you'll be referencing it via your custom noConflict identifier:

Example: my-theme/page.tpl.php


  <span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; color: rgb(0, 0, 0); "><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; color: rgb(0, 0, 187); "><?php </span><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; color: rgb(0, 119, 0); ">print </span><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; color: rgb(0, 0, 187); ">$head_title</span><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; color: rgb(0, 119, 0); ">; </span><span style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; color: rgb(0, 0, 187); ">?></span></span>
  print $head; ?>
  print $styles; ?>
 
 
  print $scripts; ?>
With this method jQuery 1.2.6 is loading with every page, and can be used by Views, Draggable.js, any contributed Ajax calls, etc. Also, jQuery 1.4.4 (as in this example) is also loading and the 2 are not interfering with each other. Another point worth adding is that 1.4.4 is being loaded from the Google CDN - one less file for your audience to download from your server.

Using noConflict in your scripts

To execute scripts with the new version of jQuery you simply need to use $jq instead of $in your scripts, for example:
$jq(document).ready(function(){
$jq('#my-div').function();
});
More information about this method: http://drupal.org/node/578712

Using noConflict in contributed scripts

You can easily modify an external script to use your custom noConflict identifier. For example, the Qtip library depends on jQuery 1.5. You could include it via the above methods and then alter jquery.qtip.js, replacing the first line
(function($, window, undefined) {
with
(function($jq, window, undefined) {

jQuery Multi module

The jQuery Multi module has built an interface around this method.

Method 3: Using jquery_update module

Unfortunately as long as the patch in http://drupal.org/node/426764 has not landed for Drupal 6 you need to hack the jquery_update module as described inhttp://drupal.org/node/1184704.
Example: Install jquery-1.7.1.js in /jquery_update/replace and hack the last bit of code of the jquery_update.module as follows
/**
* Return the path to the jQuery file.
*/
function jquery_update_jquery_path() {
  if (
arg(0) =='admin' || arg(1) == 'add' || arg(2) == 'edit' || arg(0) == 'panels' || arg(0) == 'ctools') {
   
$jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.js');
    return
JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')];
  }

  else {
   
$jquery_file = array('none' => 'jquery-1.7.1.js', 'min' => 'jquery-1.7.1.min.js');
    return
JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')];
  } 
}
?>

Method 4: Swapping jquery with preprocess page

This method has the advantage that it is specific for your theme, so if you use a different backend theme for the administration of your site, you normally should not have any problems with core js files not working anymore.
function yourModuleOrThemeName_preprocess_page(&$variables) {
 
// exclude backend pages to avoid core js not working anymore
  // you could also just use a backend theme to avoid this
 
$argArr = arg();

$scripts = drupal_add_js();
if (isset($scripts['core'], $argArr[0]) && $argArr[0] == 'test') {
    $new_jquery = array('sites/all/themes/YOURTHEME/js/jquery-1.7.1.min.js' => $scripts['core']['misc/jquery.js']);
   
$scripts['core'] = array_merge($new_jquery, $scripts['core']);
    unset(
$scripts['core']['misc/jquery.js']);

   
$variables['scripts'] = drupal_get_js('header', $scripts);
  }
}
?>

Reference:
http://drupal.org/node/1058168