Skip to main content

Posts

Showing posts from September, 2012

STUFF & REPLACE in SQL SERVER

STUFF What STUFF does is, it inserts a string for the given expression of string. At a give start_position, it will start to delete the character mentioned on the length_to_delete and insert the replacement word. STUFF(expression,start_position,length_to_delete,replace_with) eg. SELECT STUFF('Younten',5,3,'10') SELECT STUFF('Younten',5,0,'10') Output: Youn10 Youn10ten REPLACE What REPLACE does is, it will replace every character in the given string. REPLACE(expression,patter,replace_with) eg. SELECT REPLACE('Younten','Y','y') SELECT REPLACE('Younten','n','N') Output: younten YouNteN

IP address and MAC filter on Squid

Sometime having a white listed IP group in squid is problematic due to DHCP. It works perfectly on static IP address when assigned to an individual. But if you use MAC address you need not worry about IP address. Squid configuration for IP based filter. acl AllowIP src 192.168.50 acl AllowIP src 192.168.2 http_access allow AllowIP Squid configuration for MAC based filter. Create a file in squid location. Here I have create mac.txt file under squid location i.e (/etc/squid/). acl MAC arp "/etc/squid/mac.txt" http_access allow MAC My mac.txt file would contain something like this. 00:32:1e:7d:2a:00 00:xx:xx:xx:xx:xx * MAC address under windows will be shown as xx-xx-xx-xx-xx-xx where as in Linux xx:xx:xx:xx:xx:xx Make sure that your http_access allow line is before http_access deny all, else your rule will not work.

How to delete Facebook message in a single click

One of the annoying things about facebook is that, every chat and messages are listed in Messages section. In order to delete you have to first open it and then select delete. So there is two steps to delete individual message or chat history. You are displayed with "x" button in the Messages section, but its function is not to delete but to archive the selected message. Google Chrome extension named " Facebook Fast Delete Messages " actually adds a new button "x" under facebook Messages section, which will delete the Message with a single click on it.

Attach cloud file to emails using attachments.me

The attachments.me will provide a service which will allow you to easily attach a cloud files to your email. It currently works with Gmail and uses Google Drive, Dropbox, SkyDrive and Box.net as cloud storage. If you are using Google Chrome browser then, you can add an attachments.me extension and get it working smoothly. The extension for google chrome browser can be located from Chrome Web Store.

Exclude category from wordpress default widget

If you use wordpress default widget in your theme, you will notice that you don't have an option to exclude the category. In such case you can use some plugin's and get your work done, but i prefer to use less plugins and do more of coding things. So in such case I write the below code in functions.php file located in my selected theme folder. <?php function exclude_widget_categories($args){ $exclude = "1,17"; // The IDs of the excluding categories $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_args","exclude_widget_categories"); ?>