Just A Simple PHP Caching Class

Is it look real? I hope it is real. LOL

HTC ONE M7

HTC ONE M7

I just get boring today at company, and I use my phone to take a picture and I hope It will be real for I can have it for my lunch time. xD

Javascript remove a child dom element

removeChild should be invoked on the parent, i.e.:

<code>parent.removeChild(child);</code>

You should be doing something like:

<div id=”div1″>
<p id=”p1″>This is a paragraph.</p>
<p id=”p2″>This is another paragraph.</p>
</div>

<script>
var parent=document.getElementById(“div1″);
var child=document.getElementById(“p1″);
parent.removeChild(child);
</script>

jQuery/Javascript to replace broken images with onError

You want to detect your images <img> that load brokens / not found? I found this one:

Handle the onError event for the image to reassign its source using JavaScript:

<code>function imgError(image) {
    image.onerror = "";
    image.src = "/images/noimage.gif";
    return true;
}</code>
<code>&lt;img src="image.png" onerror="imgError(this);"/&gt;</code>

Or without a JavaScript function:

<code>&lt;img src="image.png" onError="this.onerror=null;this.src='/images/noimage.gif';" /&gt;</code>

 

How to Stop a Masturbation Addiction

I found this article, very fun and interesting… Hahaha.. Do you think you can stop it?

—————————————-

Masturbation happens in every culture, across every period of history, and it’s the way most adolescents discover what they enjoy before embarking on adult sexual relationships. However, if it’s becoming an obsession that inhibits other aspects of your life, or you belong to a religion or philosophy that forbids masturbation, it’s possible to curb the impulse. Here’s how to gather your self-discipline and take control of your urges.

Link: http://www.wikihow.com/Stop-a-Masturbation-Addiction

PHP Caching Class: Reduce mySQL Calls and Improve Page Load Speed?

The online apps which are created by web developers store their information in databases. A database is composed of various tables that work together to store and retrieve information for users of a web application. One ‘fetching’ of information from the database is called a query. When the web app makes a few queries, the time taken is not very much. But there are web applications making thousands of queries on every page. Such a design results in noticeably slow page loading times and obviously, end-user frustration.

One effective way to reduce this time is through an alternative technique called PHP caching. Here to help you quickly implement PHP caching in your own web app design is the tool called PHP Fast Cache.

<code>

&lt;?php
    // In your config file
    include("php_fast_cache.php");
    // This is Optional Config only. You can skip these lines.
    // phpFastCache support "apc", "memcache", "memcached", "wincache" ,"files", "pdo", "mpdo" and "xcache"
    // You don't need to change your code when you change your caching system. Or simple keep it auto
    phpFastCache::$storage = "auto";
    // End Optionals

    // In your Class, Functions, PHP Pages
    // try to get from Cache first.
    $products = phpFastCache::get("products_page");

    if($products == null) {
        $products = YOUR DB QUERIES || GET_PRODUCTS_FUNCTION;
        // set products in to cache in 600 seconds = 10 minutes
        phpFastCache::set("products_page",$products,600);
    }

    foreach($products as $product) {
        // Output Your Contents HERE
    }
&lt;/code&gt;

PHP Fast Cache is a free to use web tool that provides web developers with an easy and effective way to introduce PHP caching into their application design. In the words of the people who made the tool, “PHP Fast Cache is a high-performance, distributed object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load”.

On the site’s webpage it is claimed that employing this tool will speed up your webpage by up to 1,000 times.

The app caches PHP with files using a maximum of 50 MB per file. Caching methods used include PDO, APC, WinCache, XCache, MemCache, and MemCached.

The PHP Caching Class high-performance object caching system ever.

phpFastCache is a high-performance, distributed object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

phpFastCache dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful

Your PHP is sending 10,000 queries extractly the same to Database. Let phpFastCache reduce it to 1 query and serve your 10,000 visitors. 

From Apr 28 2013, phpFastCache is available in GitHub, and it also support more objects type caching.
API & Document is fully updated.

Example and Code Here

Maskify Slider – jQuery plugin to create slider with image mask

MaskifySlider is an extremely simple jQuery plugin which enables you to create an image slider with the effect of an image mask. The plugin will automically offset the images position according to the spacing between their placeholders, giving the impression that it’s only one masked image.

Maskify-Slider

If you don’t specify any margin, the placeholders will be close together, creating the effect of a gallery grid.
You simply pass in the set of images you want to display, and the set of placeholders to display the images in. These can be far apart of close together.
This jquery plugin supports both ways of transitions: CSS3 and JS. By default it will use CSS3, so make sure to include the keyframes animations provided in the CSS files which accompany this project.

 

Download

Example

jAutoChecklist – JQuery plugin for user-friendly select list

jAutochecklist is a jQuery plugin that help you to create an user-friendly HTML list which can be used to replace the old tradition select list.

jAutoChecklist
This jquery plugin has got the following features :-

  • User-friendly UI and interaction.
  • Fast searching with autocomplete.
  • HTML support for contents.
  • No limitation for nested group of values.

Not just limited to a simple list like select, you can make a powerful list out of it.
There are dozens of options for customizing this jquery plugin.

Download

Example

Visual LightBox – jQuery plugin for amazing lightboxes

Visual LightBox is a jQuery plugin to create web photo galleries with a nice Lightbox-style overlay effect with 30+ fancy skins.There is also a free wizard program that helps you easily generate web photo galleries with a nice Lightbox-style overlay effect, in a few clicks without writing a single line of code. Just drag&drop your photos into Visual LightBox window.

Visual-Lightbox
This jquery plugin has got the following features :-

  • Cross-browser – works perfectly on all browsers (including IE6)
  • Responsive – smoothly adapts to any browser resolutions and device screens.
  • Mobile-ready – optimized for Android and iOS devices.
  • Search engine friendly and semantically valid.
  • Unobtrusive – even without Javascript, the images are still accessible<./li>
  • Easy export to Joomla module or WordPress lightbox plugin.
  • Keyboard navigation – use left/right arrow key to navigate.

Download

Example

FilteredPaste – jQuery plugin that filters any pasted input.

FilteredPaste is a jQuery plugin that filters any pasted input so that your application gets clean input, without any tags or attributes that you don’t want. It supports native undo with control+z. IE and Opera are not supported yet.

FilteredPaste
It also comes with a default filter that :

  • allows the alt attribute on any tag.
  • allows the src attribute on img tags.
  • allows the href attribute on a and link tags.

Example Code :

$("#input3").filteredPaste();

 

Download

Example

Social-feed – jQuery plugin which shows a user feed.

Social-feed is a jQuery plugin which shows a user feed from the most popular social networks.It currently supports twitter , facebook and vk.

social-feed-jquery-plugin

Example Code

$('.social-feed-container').socialfeed({
fb_username:'barack.obama',
fb_limit:2,
fb_token:'YOUR_FACEBOOK_APP_ACCESS_TOKEN',
vk_username:1,
vk_limit:2,
tw_limit:2,
tw_username:'jack',
length:130,
cookies:true
});

Download

Example