Archive for 2014

How to get original visitor IP from Cloudflare

by 0

Clouldflare use header params:  HTTP_CF_CONNECTING_IP to provide original IP


Read more »

Build multi-platform IOS, Window mobile, Andorid app with Intel XDK

by in 0

Mobile development with web technologies is nothing new. Thanks to tools like PhoneGap and Appcelerator Titanium, web developers can create hybrid apps that have access to the device's hardware. A new solution for HTML5/CSS/JavaScript development is Intel's XDK. In this article, I'll tell you why it's worth giving it a try.

If you are involved with mobile development, you've probably heard of or used tools such as PhoneGap or Appcelerator Titanium. These tools allow web developers to use their web development skills to create hybrid mobile apps.
Last year, Intel purchased appMobi and packaged their development tools into the Intel XDK. This streamlined, unified product is a complete toolset for mobile development. A developer can go from the first lines of code to a fully compiled application in with just one set of tools. And best of all, the XDK is free to download.

Read more »

What is the difference between Cloud Server (Cloud VPS) with VPS

by in 0

Traditional VPS’s do not have centralized storage which means if your node goes down you could be down for hours. If your data is corrupt in a VPS environment it might be gone forever. Also, if you want to scale on your VPS you are limited based on the amount of resources that is on the node your data is on.


Read more »

adf.ly, lienscash.com, adfoc.us, bc.vc bypasser extension for Chrome

by in 3


No longer worry about adf.ly...

Ketnooi Paid Link Bypasser extension for Chrome

Just install this script and enjoy the auto bypassing on that bad websites (currently adf.ly, lienscash.com, adfoc.us, bc.vc).
This script is compatible with Chrome/Chromium.
Report to me any problem, and.. thanks for using the script!

Version 5.1
- fixed bc.vc again
- fixed AGAIN adf.ly bypasser (HiTommy? Really?)
Version 5
- fixed adf.ly again (nice try I should say)
Old changelogs are available in the script source.

Link download:
Chrome store
or
Download

Install:
- Extract
- Drop n Drag file .crx into Extension manager of chrome

Just comment here to let me know any problem while using this extension

View all animated gifs in a folder at the same time?

by 0

Window don't support this function
So we have to create a html which contain all gifs in the folder

Open notepad, put this text inside:


FOR /F %%G IN ('dir /B *.gif') DO echo ^^ %%G^
 >> gifs.html
Save as "showgifs.bat"

Then run it. The script will generate file gifts.html
Then You can opoen that file with any browser

Replace a color with another with GIMP free photo editor

by 0

In GIMP, to change white to blue:
  • Open the image file
  • menu Colors/Map/Color Exchange
  • Press the colour selection for "From Color". Set R, G and B to all 255. Press OK button.
  • Press the colour selection for "To Color". Set R and G to all 0. Set B to 255. Press OK button.
  • Press OK button.
White and black are special... If you want to translate all other colours then:
  • Open the image file
  • menu Colors/Hue-Saturation
  • Press "Master" button
  • Drag the Hue slider

You can download Gimp portable in :

Replace Colors with the Replace Color Tool in Firework

by 0

Replacing Colors with the Replace Color Tool
It is very easy to change colors in a photo or object with the color swatch tool. Remember that Fireworks looks at color in pixels. No object has the exact color throughout. This is where the tolerance comes in. You want to play with the tolerance until you get the color variation that picks up all the color shades of the color you want to replace. The picture I am using for this tutorial was taken directly from the Fireworks help topics packaged with the program:

Read more »

get head content of page with jquery

by in , 0

You can use this code:
With Jquery


$("head")
//for example:
alert($("head").html());

With JS:

var headContent = document.getElementsByTagName("head")[0].innerHTML;

Convert a utf-8 string to a utf-16 string in PHP

by in 0

- You could also use iconv.
It's native in PHP, but require that all your text is one charset. Else it could discard characters.
iconv("UTF-8""UTF-16"$text)

- In other way, mbstring supports UTF-16, so you can use mb_convert_encoding.

source

Best Lightweight and Responsive Front-End Frameworks

by in , , , 0

With fast processing websites in huge demand, developers have switched their preferences. From adding new functionality, to make their responsive frameworks lightweight while ensuring seamless and fast processing across all devices. Having a lightweight and responsive website is the need of the hour as visitors usually don’t prefer sites that take time to load.
In this era of speed, all you need is a lightweight and solid base to build your responsive website. Here are a few lightweight front-end frameworks that can aid you in your work.

Read more »

Localize Your Android Apps (Default files and folders)

by in 0

Thinking about localizing your android app, well it is without a doubt a great way to popularize your app. Localization is one of the fastest growing trends in the app world today.
Localization is a process to provide resources for your app in accordance with the language setting of the device. The need to provide support of local language on the app is due to the fact that most users prefer reading and communicating in their local language.
Before you jump into this localizing wagon make sure what you want from your app. You want to target only the local audience or global audience as well?
Localizing your app is only beneficial if you’re targeting different regions with variety of languages. In order to appeal to more-and-more users, your app should support texts, currency, audio files, numbers, and graphics according to the locales.
If you want to make your android app global, you need to support local languages. For this you require resource files that are placed in the subdirectories of “res” folder. An additional directory is created inside “res/” which enables you to use a resource in a particular locale. Inside this directory, include a hyphen along with an ‘ISO 639-1 language codes’ at the end of the directory name. After this you can add two optional letters ‘ISO 3166-1-alpha-2 region code’ (preceded by ‘r’).
The inclusion of region qualifier helps in hitting the target resource more effectively. For instance, use ‘-es-rES’ for Espana (Spanish spoken in Spain) and ‘-es-rUS’ for Estados Unidos (Spanish spoken in Latin America), instead of ‘-es’ the language qualifier for Spanish.
Now, when the user runs the app and the device’s language matches the language you have specified, the language resources are loaded.

Read more »

Writer SEO hints

by in 0

Often you would have observed that some sentences in the articles or blogs are not perfect. This leads to the question that is sacrificing perfect sentence structure the way to find your space in the writing field?
In the lure to write more creative article or blog that appeals to the target audience, an audience that might not have good control over the English language, writers sometimes have to write less-than-perfect but easily understandable content.
This makes the work of editors that more difficult. Writers should not misuse this privilege and imagine no one will notice. In this article, we will take a look at a few common mistakes committed by writers, and how they can avoid committing them.

Read more »

How to style the first occurrence of an element inside of another element?

by in , 0

Here's my problem.
HTML
<div id="content">
    <h1>Headline</h1>
    <p>First paragraph that needs to be yellow.</p>
    <p>Second paragraph that need not change. :) </p>
    <p>Third paragraph that need not change. :) </p>
</div>
If I use #content p:first-child {color:yellow; } it doesn't work because p isn't the first-child of content... h1 is the first born.
How can I do this without touching the HTML code?

Read more »

PDO query to fetch all tables

by in , 0

Execute the query with PDO::query():
SHOW TABLES;
If you fetch an associative array, the name of the column will be:
Tables_in_databasename
Note: this will list both tables and views. If you must get only tables, use this instead:
SELECT 
  TABLE_NAME
FROM information_schema.TABLES 
WHERE
  TABLE_TYPE='BASE TABLE'
  AND TABLE_SCHEMA='yourdatabasename';

PHP Fix errors if mbstring is not loaded

by in 0

My script work good on shared hosting until hosting disable mbstring

Now my script can't run.
Many functions MB_  mb_strrpos mb_get_info .... get undefined errors.

Read more »

How to download Free pdf from Scribd without paying

by 0

Download pdf from Scribd without paying : Are you searching for pdf or ebook??? Scribd.com is world largest digital library and has very large collection of documents which can you download either in PDFs format or doc.
As a student, I know the value of eBooks and no one wants to pay for the eBook. A few weeks ago I was searching for ebook and surprisingly I found that solely on Scribd so eagerly click on the download button, but after registering on this site it offers membership which requires a few dollars. But like me you can download any free document from Scribd by following simple steps.

Read more »

Htaccess show no_found picture if picture is not exist

by in , 0

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*$ /no_picture.png [L]
Let's break it down as to what each line means.
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png)$ [NC]
Check to see if the requested file is of a file extension in the parentheses (). In this case, we're testing to see if the file name ends in either .jpg, .jpeg, .gif or .png
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Check that the file is not there and it's also not a directory.
RewriteRule .*$ /no_picture.png [L]
If a requested resource/file passes all those tests, then it's an image that does not exist. So serve back the image of no_picture.png to the browser. This will keep the filename. If you want to redirect to the no_picture.png filename, change [L] to [R]

auto refresh for every 5 mins in Javascript

by in 0

We can do this function with just html  or just javascript

Refresh document every 300 seconds using HTML Meta tag add this inside the head tag of the page
 <meta http-equiv="refresh" content="300">
Or using Java Script:
            setInterval(function() {
                  window.location.reload();
                }, 300000); 

jQuery javascript regex Replace br tag with \n

by in , , 0

var str = document.getElementById('mydiv').innerHTML;
document.getElementById('mytextarea').innerHTML = str.replace(/<br\s*[\/]?>/gi, "\n");
or using jQuery:
var str = $("#mydiv").html();
var regex = /<br\s*[\/]?>/gi;
$("#mydiv").html(str.replace(regex, "\n"));
edit: added i flag
edit2: you can use /<br[^>]*>/gi wich will match anything between the br and slash if you have for example <br />

Source:

jQuery javascript regex Replace <br> with \n

disable selected options by jQuery

by in , 0

This will disable/enable the options when you select/remove them, respectively.
$("#theSelect").change(function(){          
    var value = $(this).val();
    if (value === '') return;
    var theDiv = $(".is" + value);

    var option = $("option[value='" + value + "']", this);
    option.attr("disabled","disabled");

    theDiv.slideDown().removeClass("hidden");
    theDiv.find('a').data("option",option);
});


$("div a.remove").click(function () {     
    $(this).parent().slideUp(function() { $(this).addClass("hidden"); });
    $(this).data("option").removeAttr('disabled');
});
Source: 
jQuery - disable selected options

JavaScript QR Code Reader

by in , 0

I'm doing a bit of preliminary research on an upcoming project and I have a quick question that I figure I'll throw up here while I look elsewhere, in case anyone has any experience with this.
The question is simple: is it possible to read a QR code using JavaScript? Is there a remote service to which I can pass a bitmap object from a camera and do it that way? Are there currently any libraries that allow this?
The project is going to be deployed to various mobile devices and we'd like to try to use Appcelerator to make it work. I know Appcelerator does expose the Camera API on its host devices, but whatever we do with it has to be able to parse QR codes. Is this something that can be done?
Thanks in advance!

Read more »

How to Get all attributes of an element using jQuery

by in , 0

I am trying to go through an element and get all the attributes of that element to output them, for example an tag may have 3 or more attributes, unknown to me and I need to get the names and values of these attributes. I was thinking something along the lines of:

Read more »

10 Mobile Touch Javascript Frameworks

by in , 0

Mobile development is not an easy job for a developer who doesn’t know about the latest technologies, updates and trends that’s why mobile development is a stressful job. Major challenges a mobile developer faces are screen resolution, cross browser compatibility.
We know many of these issues have been solved as the mobile development industry is growing up. Now, we can see mobile websites with beautiful layouts are being developed. These mobile websites also have touch screen functionality that is developed with the help of different frameworks to work on tablets and smartphones.





Now, folks love to surf websites via their tablets, smartphones etc. So, having a mobile edition of your website is necessary. All this has been possible because of JavaScript, which has developed many frameworks to display our websites on mobile devices smoothly. So, below is the list of my Top 10 Mobile Touch JavaScript Frameworks.

1. pointer.js

pointer.js-
If you want unifying mouse and touch systems, pointer.js is the best tool. pointer.js reinforces pointer-like input models to work on various devices and browsers. You can do multi-touch drawing, gesture event logger and pointer event logger.

Read more »

6 jQuery Responsive Layout for mobile

by in 0

1. app-UI

TV Listings
app-UI may be helpful to mobile and web developers for developing interactive mobile or web applications using HTML and JavaScript. The animations are hardware accelerated and are rendered using CSS3 translate3d.

Read more »

Best 20 FlipBook responsive jQuery

by in , 0

1. WowBook, create ebooks with page flip

With WowBook, you can easily crate an online publication with two flipping effects. This plugin doesn’t need flash and supports all the major browsers. It also has zoom functionality, keyboard navigation and mousewheel navigation.

Read more »

Fix OpenSSL Heartbleed for Server admin

by 0

This is  How to Fix OpenSSL Heartbleed for Server admin

Over the past few days, we have received an overwhelming number of questions about the OpenSSL Heartbleed bug and how cPanel system administrators should be handling this.
First of all, if you haven’t read Codenomicon’s write-up on the bug, which thoroughly explains what it is, you should look visit heartbleed.com. Because their website already covers just about everything you need to know, I don’t feel the need to rehash all the nitty-gritty details here.  I’m only going to address how you, a cPanel administrator, should address this on your server.
Only CentOS 6.5 is vulnerable to this bug.  Obviously this affects other OS’s as well, but as a cPanel administrator you’re only dealing with CentOS (and perhaps FreeBSD).  If you use a version of CentOS older than 6.5, read no further – you’re not affected and can rest easy.
You can test whether you’re vulnerable by using this tool against a website on your server that has an SSL certificate installed.
To clear this up real quick: OpenSSL is a vendor-supplied package that, in your case, is provided by CentOS.  It is not supplied by cPanel, so there’s no point in asking them to “fix” this.  There is nothing for them to fix.  However, if you have system package upgrades enabled for cpupdate, and cPanel updates run automatically on your server, chances are the OpenSSL updates have already been installed.  To configure your cPanel update settings, check out this link, or go to WHM -> Update Preferences.
Check to see if you’re running the latest version as so:

root@server [~]# rpm -qa |grep -i openssl
openssl-1.0.1e-16.el6_5.7.x86_64
openssl-devel-1.0.1e-16.el6_5.7.x86_64
At this point you’re looking for version 1.0.1e or newer (at the time of this writing, 1.0.1e is the latest).  This update does not necessarily fix the bug in question, but rather disables the TLS heartbeat extensions that are vulnerable.  A later version will likely fix the problem altogether, but such is not available yet because RHEL has not released a fix.

You also use this command to update Openssl:
yum update openssl

After OpenSSL is updated, you need to restart services.  This is necessary whether you updated OpenSSL yourself, or let cPanel do it during its update process.  The following services should be restarted:
  • cPanel
  • Apache
  • Exim
  • Dovecot/Courier
  • Pure-ftpd/Proftp
  • MySQL
  • any other services that use SSL (Tip: you can use the following command to find a list of services to restart)
lsof -n | grep ssl | grep DEL | awk ‘{print $1}’ | sort | uniq
OR REBOOT for quickest way


Once this is done, you should be good to go.  It is recommended, however, that you re-key your SSL certificates and have then re-issued and re-installed to prevent security problems resulting from a compromised private key.


Revoking and Reissuing your SSL Certs/Keys

If you have purchased an SSL certificate from a provider and you have updated your OpenSSL packages on your server, you will need to revoke your old keys and you'll have to reissue new keys. This is a process known as "rekeying".
This process is very dependent upon the SSL service that issued your initial certificate, but you should search their administration interface for an option that is similar to "rekey" or "reissue keys". Most SSL issuers will revoke your former key when you rekey, but you can usually also do this explicitly using their administrative interface.
Follow the directions that your SSL provider gives you. They may give you very specific instructions for how to regenerate a CSR, or they may not.
If they do not provide you with the specific openssl commands that they would like you to use, you can generate your new SSL CSR by typing something like this. Again, add sudo if you are not root:
openssl req -new -newkey rsa:2048 -nodes -keyout hostname.key -out hostname.csr
You will need to copy your generated CSR into your provider's web interface after generation in order to rekey your server. You will then need to download the new certificate from the web interface.
You will have to install the new keys to the same location that your old keys and certificates were kept. The path that you'll need to use for your certificate and keys will vary by distribution and how you configured your web server. For instance, some are kept in /etc/ssl/certs while others may be kept in locations provided by your web server.
For example, if you are using the Apache web server, you should see a line in your main Apache configuration file, a virtualhost file, or a separately sourced configuration file that points to the location where it looks for your SSL information:
SSLEngine on
SSLCertificateFile /path/to/your_domain.crt
SSLCertificateKeyFile /path/to/your_key.key
SSLCertificateChainFile /path/to/CA.crt
These may look different, but they should point you in the correct direction to find your SSL certificate location.
If you are using Nginx, you'll find similar directives that point to your server's SSL certificate and key. They might look something like this:
server {
    . . .
    ssl_certificate /path/to/your_domain.crt;
    ssl_certificate_key /path/to/your_key.key;
    . . .
}
Another option is to check your distribution's documentation or check your server's filesystem to find out where your certificates are stored.
When you are finished, you should restart your web server to use the new keys. The method of doing this will vary by distribution and server.
On Debian or Ubuntu, you can restart your web server by typing:
sudo service apache2 restart    # For Apache web server
sudo service nginx restart      # For Nginx web server
On CentOS or Fedora, you can restart by typing:
sudo service httpd restart      # For Apache web server
sudo service nginx restart      # For Nginx web server
For Arch Linux you should use something like:
sudo systemctl restart httpd.service
sudo systemctl restart nginx.service
This should allow your web server to pick up your new certificate changes.

Additional Considerations from a Client's Perspective

Because of the widespread nature of this bug, there are other considerations that you should take into account as well. As a consumer of web services and sites, you should also react quickly to try to minimize the potential damage to your accounts and information.
You should consider any communication that you secured by SSL previously to have been compromised by this bug. This means any kind of interaction with secure websites were open to snooping.
A good first step is to change your password on every site that you use, after you have verified that they have updated their OpenSSL versions to patch this vulnerability. If you change your password prior to the remote site patching their SSL version, your new password is just as vulnerable as your old one.
One consideration that is of high importance is to secure any VPN instances that you have set up. There are a few different ways that VPN connections are implemented, but SSL is one of the most popular. For instance, OpenVPN uses SSL. Any certificates required to connect to your server should be regenerated to ensure that they are secured.

Another good measure is to remove all session keys and cookies. This means regenerate API keys, clear cookies that are stored in your browser, etc. This may be a massive inconvenience, but the cost of not going through these pains now is that your accounts are basically wide open and communication with remote servers that have not updated their OpenSSL should be considered no more secure than plain-text.

CSS parser in PHP

by in 0

 <?php
include("cssparser.php");

$css = new cssparser();
$css->ParseStr("b {font-weight: bold; color: #777777;} b.test{text-decoration: underline;}");
echo $css->Get("b","color");     // returns #777777
echo $css->Get("b.test","color");// returns #777777
echo $css->Get(".test","color"); // returns an empty string
?> 

You can Parser Css code in php easily

PHP function detect utf8 string

by in 0

It's working on PHP4, PHP5


function is_utf8($str) {
    $c=0; $b=0;
    $bits=0;
    $len=strlen($str);
    for($i=0; $i<$len; $i++){
        $c=ord($str[$i]);
        if($c > 128){
            if(($c >= 254)) return false;
            elseif($c >= 252) $bits=6;
            elseif($c >= 248) $bits=5;
            elseif($c >= 240) $bits=4;
            elseif($c >= 224) $bits=3;
            elseif($c >= 192) $bits=2;
            else return false;
            if(($i+$bits) > $len) return false;
            while($bits > 1){
                $i++;
                $b=ord($str[$i]);
                if($b < 128 || $b > 191) return false;
                $bits--;
            }
        }
    }
    return true;
}

Function php convert string to UTF-8

by in 0

conver string to Utf8 if String is not equals to 'UTF-8'




/*
*QQ: 290359552
* conver to Utf8 if $str is not equals to 'UTF-8'
*/
function convToUtf8($str)
{
if( mb_detect_encoding($str,"UTF-8, ISO-8859-1, GBK")!="UTF-8" )
{

return  iconv("gbk","utf-8",$str);

}
else
{
return $str;
}

} 

Get sub array in PHP

by 0

array_slice()
$subArray = array_slice($arr,0,4);

function detect Unicode UTF-8 string PHP

by in 0

Based upon that snippet below using preg_match() I needed something faster and less specific.  That function works and is brilliant but it scans the entire strings and checks that it conforms to UTF-8




function detectUTF8($string)
{
        return preg_match('%(?:
        [\xC2-\xDF][\x80-\xBF]        # non-overlong 2-byte
        |\xE0[\xA0-\xBF][\x80-\xBF]               # excluding overlongs
        |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}      # straight 3-byte
        |\xED[\x80-\x9F][\x80-\xBF]               # excluding surrogates
        |\xF0[\x90-\xBF][\x80-\xBF]{2}    # planes 1-3
        |[\xF1-\xF3][\x80-\xBF]{3}                  # planes 4-15
        |\xF4[\x80-\x8F][\x80-\xBF]{2}    # plane 16
        )+%xs', $string);
}

Tooltips In only CSS3 And HTML5, Without JavaScript

by in , 0

Tooltips in HTML pages general do not need any effort from a developer’s side, as long as they put proper title attributes to their elements. The title is then used for showing the tooltip, but also for other things, such as providing a screen reader with proper content. Speaking of the use case of tooltips, the visual presentation depends on the browser your site gets visited with. Developers with the need for more control turned to JavaScript bases solutions years ago. Kashagra Gour created Hint.css, which proves as a decent alternative, based completely on CSS and HTML.

Hint.css – Data Attributes, CSS3 Transitions, Pseudo Elements and the Content Property


Read more »

HTML5 Jquery tooltip

by in 0

Tooltips are a square deal. They allow for the placement of important information just in the very location this information is needed, regardless of screen real estate. Tooltipster is a plugin for jQuery aiming at making the process of creating tooltips as easy as possible while providing the biggest functionality available. They conform to HTML5 and can be styled to your own liking using CSS.

Read more »

CSS to align label and input

by in , 0

HTML Code Snippet:
<fieldset id="o-bs-sum-buginfo">
  <label for="o-bs-sum-bug-ErrorPrefix">Error Prefix</label>
  <input type="text" id="o-bs-sum-bug-ErrorPrefix" name="ErrorPrefix" value="" />

  <label for="o-bs-sum-bug-ErrorNumber">Error Number</label>
  <input type="text" id="o-bs-sum-bug-ErrorNumber" name="ErrorNumber" value="" />
  ....
</fieldset>
Using only CSS (or jquery), irrespective of the browser size, I want to pair label and input elements next to each other. I also do have freedom to change tweak the HTML. if required.



Put the every label with its corresponding input into a p tag. Then add the following css:
label{
  float:left;
  width:100px; //whatever width that suits your needs
}

p{
    margin:10px 0; //manipulate the vertical spaces for each input..  
}



<fieldset >
  <p>
    <label for="o-bs-sum-bug-ErrorPrefix">Error Prefix</label>
    <input type="text"  name="ErrorPrefix" value="" />
  </p>
</fieldset>

jquery disable form submit on enter

by in , 0

You can disable button on Submit but user can Enter to submit.

So you i use this code:

I have the following javascript in my page which does not seem to be working.
$('form').bind("keypress", function(e) {
  if (e.keyCode == 13) {               
    e.preventDefault();
    return false;
  }
});
I'd like to disable submitting the form on enter, or better yet, to call my ajax form submit. Either solution is acceptable but the code I'm including above does not prevent the form from submitting.

Solution:

jquery disable form submit on enter


Usually form is submitted on Enter when you have focus on input elements.
We can disable Enter press on input elements within a form:
$("form :input").on("keypress", function(e) {
    return e.keyCode != 13;
});​

Get Remote file size without downloading file

by 0

Is there a way to get the size of a remote file http://my_url/my_file.txt without downloading the file?

Solution:

Found something about this :
Here's the best way (that I've found) to get the size of a remote file. Note that HEAD requests don't get the actual body of the request, they just retrieve the headers. So making a HEAD request to a resource that is 100MB will take the same amount of time as a HEAD request to a resource that is 1KB.
<?php/** * Returns the size of a file without downloading it, or -1 if the file * size could not be determined. * * @param $url - The location of the remote file to download. Cannot * be null or empty. * * @return The size of the file referenced by $url, or -1 if the size * could not be determined. */function curl_get_file_size( $url ) {  // Assume failure.  $result = -1;  $curl = curl_init( $url );  // Issue a HEAD request and follow any redirects.  curl_setopt( $curl, CURLOPT_NOBODY, true );  curl_setopt( $curl, CURLOPT_HEADER, true );  curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );  curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true );  curl_setopt( $curl, CURLOPT_USERAGENT, get_user_agent_string() );  $data = curl_exec( $curl );  curl_close( $curl );  if( $data ) {    $content_length = "unknown";    $status = "unknown";    if( preg_match( "/^HTTP\/1\.[01] (\d\d\d)/", $data, $matches ) ) {      $status = (int)$matches[1];    }    if( preg_match( "/Content-Length: (\d+)/", $data, $matches ) ) {      $content_length = (int)$matches[1];    }    // http://en.wikipedia.org/wiki/List_of_HTTP_status_c...     if( $status == 200 || ($status > 300 && $status <= 308) ) {      $result = $content_length;    }  }  return $result;}?>
Usage:
$file_size = curl_get_file_size( "http://abc.com/questions/2602612/php-remote-file-size-without-downloading-file" );


Source: 
PHP: Remote file size without downloading file

Prevent multiple inserts when submitting a form in PHP

by in 0

Sometimes the user may press Enter twice, and the post is inserted twice.

Is there a solution to prevent this other than check if there is already a post with the same title and content?

Solutions:
1- Use JavaScript to stop it from sending

2 - disable the submit button once the user has submitted the form, using JavaScript. That is what, for example
3 - Include a unique token on each POST worked for me. However, my form still submits when a user refreshes the page (F5). I managed to solve this by adding a reset:
            // reset session token
            $_SESSION['token'] = md5( $_POST['token'] . time() );
my final scripts goes like:
if (isset($_SESSION['token'])) {
    if (isset($_POST['token'])) {
        if ($_POST['token'] != $_SESSION['token']) {
            echo '<h3>Oops! You already submitted this request.</h3>';
        } else {
            // process form
            // reset session token
            $_SESSION['token'] = md5( $_POST['token'] . time() );
        }
    } else {
        echo 'post token not set';
        $_SESSION['token'] = md5( $somevariable . time() );
    }
}
oh! don't forget to add session_start(); before <!DOCTYPE>
I am a PHP newbie so please correct me if you find irregularities.


Source:
How to prevent multiple inserts when submitting a form in PHP?



Remove URL from string PHP

by in 0

f I have a string that contains a url (for examples sake, we'll call it $url) such as;

$url = "Here is a funny site http://www.tunyurl.com/34934";
How do i remove the URL from the string? Difficulty is, urls might also show up without the http://, such as ;
$url = "Here is another funny site www.tinyurl.com/55555";

There is no HTML present. How would i start a search if http or www exists, then remove the text/numbers/symbols until the first space?


##########

function containsTLD($string) {
  preg_match(
    "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($|\/)|\.AQ($|\/)|\.AR($|\/)|\.ARPA($|\/)|\.AS($|\/)|\.ASIA($|\/)|\.AT($|\/)|\.AU($|\/)|\.AW($|\/)|\.AX($|\/)|\.AZ($|\/)|\.BA($|\/)|\.BB($|\/)|\.BD($|\/)|\.BE($|\/)|\.BF($|\/)|\.BG($|\/)|\.BH($|\/)|\.BI($|\/)|\.BIZ($|\/)|\.BJ($|\/)|\.BM($|\/)|\.BN($|\/)|\.BO($|\/)|\.BR($|\/)|\.BS($|\/)|\.BT($|\/)|\.BV($|\/)|\.BW($|\/)|\.BY($|\/)|\.BZ($|\/)|\.CA($|\/)|\.CAT($|\/)|\.CC($|\/)|\.CD($|\/)|\.CF($|\/)|\.CG($|\/)|\.CH($|\/)|\.CI($|\/)|\.CK($|\/)|\.CL($|\/)|\.CM($|\/)|\.CN($|\/)|\.CO($|\/)|\.COM($|\/)|\.COOP($|\/)|\.CR($|\/)|\.CU($|\/)|\.CV($|\/)|\.CX($|\/)|\.CY($|\/)|\.CZ($|\/)|\.DE($|\/)|\.DJ($|\/)|\.DK($|\/)|\.DM($|\/)|\.DO($|\/)|\.DZ($|\/)|\.EC($|\/)|\.EDU($|\/)|\.EE($|\/)|\.EG($|\/)|\.ER($|\/)|\.ES($|\/)|\.ET($|\/)|\.EU($|\/)|\.FI($|\/)|\.FJ($|\/)|\.FK($|\/)|\.FM($|\/)|\.FO($|\/)|\.FR($|\/)|\.GA($|\/)|\.GB($|\/)|\.GD($|\/)|\.GE($|\/)|\.GF($|\/)|\.GG($|\/)|\.GH($|\/)|\.GI($|\/)|\.GL($|\/)|\.GM($|\/)|\.GN($|\/)|\.GOV($|\/)|\.GP($|\/)|\.GQ($|\/)|\.GR($|\/)|\.GS($|\/)|\.GT($|\/)|\.GU($|\/)|\.GW($|\/)|\.GY($|\/)|\.HK($|\/)|\.HM($|\/)|\.HN($|\/)|\.HR($|\/)|\.HT($|\/)|\.HU($|\/)|\.ID($|\/)|\.IE($|\/)|\.IL($|\/)|\.IM($|\/)|\.IN($|\/)|\.INFO($|\/)|\.INT($|\/)|\.IO($|\/)|\.IQ($|\/)|\.IR($|\/)|\.IS($|\/)|\.IT($|\/)|\.JE($|\/)|\.JM($|\/)|\.JO($|\/)|\.JOBS($|\/)|\.JP($|\/)|\.KE($|\/)|\.KG($|\/)|\.KH($|\/)|\.KI($|\/)|\.KM($|\/)|\.KN($|\/)|\.KP($|\/)|\.KR($|\/)|\.KW($|\/)|\.KY($|\/)|\.KZ($|\/)|\.LA($|\/)|\.LB($|\/)|\.LC($|\/)|\.LI($|\/)|\.LK($|\/)|\.LR($|\/)|\.LS($|\/)|\.LT($|\/)|\.LU($|\/)|\.LV($|\/)|\.LY($|\/)|\.MA($|\/)|\.MC($|\/)|\.MD($|\/)|\.ME($|\/)|\.MG($|\/)|\.MH($|\/)|\.MIL($|\/)|\.MK($|\/)|\.ML($|\/)|\.MM($|\/)|\.MN($|\/)|\.MO($|\/)|\.MOBI($|\/)|\.MP($|\/)|\.MQ($|\/)|\.MR($|\/)|\.MS($|\/)|\.MT($|\/)|\.MU($|\/)|\.MUSEUM($|\/)|\.MV($|\/)|\.MW($|\/)|\.MX($|\/)|\.MY($|\/)|\.MZ($|\/)|\.NA($|\/)|\.NAME($|\/)|\.NC($|\/)|\.NE($|\/)|\.NET($|\/)|\.NF($|\/)|\.NG($|\/)|\.NI($|\/)|\.NL($|\/)|\.NO($|\/)|\.NP($|\/)|\.NR($|\/)|\.NU($|\/)|\.NZ($|\/)|\.OM($|\/)|\.ORG($|\/)|\.PA($|\/)|\.PE($|\/)|\.PF($|\/)|\.PG($|\/)|\.PH($|\/)|\.PK($|\/)|\.PL($|\/)|\.PM($|\/)|\.PN($|\/)|\.PR($|\/)|\.PRO($|\/)|\.PS($|\/)|\.PT($|\/)|\.PW($|\/)|\.PY($|\/)|\.QA($|\/)|\.RE($|\/)|\.RO($|\/)|\.RS($|\/)|\.RU($|\/)|\.RW($|\/)|\.SA($|\/)|\.SB($|\/)|\.SC($|\/)|\.SD($|\/)|\.SE($|\/)|\.SG($|\/)|\.SH($|\/)|\.SI($|\/)|\.SJ($|\/)|\.SK($|\/)|\.SL($|\/)|\.SM($|\/)|\.SN($|\/)|\.SO($|\/)|\.SR($|\/)|\.ST($|\/)|\.SU($|\/)|\.SV($|\/)|\.SY($|\/)|\.SZ($|\/)|\.TC($|\/)|\.TD($|\/)|\.TEL($|\/)|\.TF($|\/)|\.TG($|\/)|\.TH($|\/)|\.TJ($|\/)|\.TK($|\/)|\.TL($|\/)|\.TM($|\/)|\.TN($|\/)|\.TO($|\/)|\.TP($|\/)|\.TR($|\/)|\.TRAVEL($|\/)|\.TT($|\/)|\.TV($|\/)|\.TW($|\/)|\.TZ($|\/)|\.UA($|\/)|\.UG($|\/)|\.UK($|\/)|\.US($|\/)|\.UY($|\/)|\.UZ($|\/)|\.VA($|\/)|\.VC($|\/)|\.VE($|\/)|\.VG($|\/)|\.VI($|\/)|\.VN($|\/)|\.VU($|\/)|\.WF($|\/)|\.WS($|\/)|\.XN--0ZWM56D($|\/)|\.XN--11B5BS3A9AJ6G($|\/)|\.XN--80AKHBYKNJ4F($|\/)|\.XN--9T4B11YI5A($|\/)|\.XN--DEBA0AD($|\/)|\.XN--G6W251D($|\/)|\.XN--HGBK6AJ7F53BBA($|\/)|\.XN--HLCJ6AYA9ESC7A($|\/)|\.XN--JXALPDLP($|\/)|\.XN--KGBECHTV($|\/)|\.XN--ZCKZAH($|\/)|\.YE($|\/)|\.YT($|\/)|\.YU($|\/)|\.ZA($|\/)|\.ZM($|\/)|\.ZW)/i",
    $string,
    $M);
  $has_tld = (count($M) > 0) ? true : false;
  return $has_tld;
}

function cleaner($url) {
  $U = explode(' ',$url);

  $W =array();
  foreach ($U as $k => $u) {
    if (stristr($u,".")) { //only preg_match if there is a dot    
      if (containsTLD($u) === true) {
      unset($U[$k]);
      return cleaner( implode(' ',$U));
    }      
    }
  }
  return implode(' ',$U);
}


$url = "Here is another funny site badurl.badone somesite.ca/worse.jpg but this badsite.com www.tinyurl.com/55555 and http://www.tinyurl.com/55555 and img.hostingsite.com/badpic.jpg";
echo "Cleaned: " . cleaner($url);
returns:

Cleaned: Here is another funny site badurl.badone but this and and

Free Music player for website, blogger

by in , 0

Ketnooi Music release Free new Music player for Webmasters.
You can embed K-Player to your blog, blogspot easily.
Demo see this blog
Features:
- Free music/Video for your vistors
- Easy to embed
- Light speed
- Integrate with any website, blog.
- Music is not breakable even if vistor go to new page


Just go to Video.Ketnooi.com, then create your own playlist, Save it, then get embed Code
 
Have fun!

javascript replace only first instance .replace?

by in 0

I have this
 var date = $('#Date').val();
this get the value in the textbox what would look like this
12/31/2009
Now I do this on it
var id = 'c_' + date.replace("/", '');
and the result is
c_1231/2009
It misses the last '/' I don't understand why though.

Read more »

BEST 200+ Free Responsive HTML5 templates

by in , , 0

free Collection of responsive html5 css3 templates are well-designed layout template for any kind of business, company, personal, blog, website with new html5 and css3 features! (updated 2014)

All free premium responsive Using HTML5 and CSS3 features are popular among web designers nowadays. HTML5 also provide great features to create animation on web instead of flash animation. Websites developed in HTML5 animation will not require adobe flash support on your web browser anymore, provided that your browser supports HTML5. There are more kind of html5 css3 website templates such education templates, hotel templates and more.

Free HTML5 Theme for Interior Site

Free HTML5 Theme for Business Site

Read more »

Simple Responsive Drop Down Menu jQuery CSS3

by in , 0

A beauty drop down responsive menu that shows its sub menus with icon symbol using open symbol fonts that allowing you to add more icons as you want. With my previous tutorial, i also show how to create Creating 3-Level Responsive Drop Down Navigation Menu with jQuery and CSS3 as well.
demo-drop-down-menu



Today we would like to show an experimental drop-down menu with jquery and css3 using beautiful symbol fonts. The main idea is to help you to save time for creating menus for website, it have a lot of content and sub-levels. Some sub-level in this menu will be shown in its context and icons. The menu is best use in professional web design that it can be used easily in a responsive layout.
This Responsive Drop Down Navigation Menu using plugin such as:

Read more »

30 Best HTML5 3D Effect examples

by in , 0

In this article you will see that there are some amazing HTML5 and CSS3 3D graphics examples with demo link. Usually, HTML5 goes hand in hand with CSS3 to create the professional web experiences. In fact, websites developed in HTML5 animation will not require adobe flash support on your Web browser anymore, provided that your browser supports HTML5.
Many people believe that HTML5 new advanced technology to create professional website and animation templates on web online in stead of flash. HTML5 is a lightweight, powerful and easy to use platform such as games, 3D animation, 3D graphics by using HTML5 canvas, CSS3 and JavaScript. In fact, HTML5 and CSS3 represents the future of mobile browsing and that’s because of it’s comprehensive and lightweight abilities.
CSS 3D transforms are smooth, hardware accelerated and simple to implement, with browsers taking on what would be very difficult perspective calculations.
Recommendation: For best results, please use a browser that supports HTML5 and CSS3 such as Google Chrome, Latest Versions of Firefox or Opera

The World Wonders 3D globe

The World Wonders 3D globe

3D CSS Text

3D CSS Text

Read more »

Change Default Text Selection Color by CSS

by in , 0

Whilst this CSS3 declaration might not be crucial to your project or design and yes it is not supported by all browsers, but it is a fantastic effect that really takes your design one step further.
Currently FireFox, Safari, Chrome and Opera support the text section attribute, and the browsers that don’t support it simply ignore the code so nothing will break, so it doesn’t really matter.
We have setup a demo which you can test out further down the page; we have used the Design Juices colours in the example.



Read more »

Sticky notes CSS3

by in , 0


I’ve been working on a pretty cool wall-mounted status board as one of my projects at Fog Creek. It’s a webapp that runs on a vertically mounted LCD screen in our office. It displays a bunch of interesting information like tech support calls, staff vacations, tweets about FogBugz, and more.

I’ve been incrementally adding features and improving the UI whenever I have spare cycles. The other night, I decided to redesign the Kanban board widget, which is a list of the top N things that the customer team needs from engineering. I decided to go with a sticky note UI that mimics a real-life Kanban board, which typically consists of a giant white board filled with a bunch of sticky notes.

My initial design used the classic yellow sticky notes, which I thought looked pretty neat. I showed my co-worker Rich who suggested that we make the notes look like the FogBugz and Kiln notepads that are laying around the office. Awesome idea! Way better.



Read more »

Rotating Image Slideshow Jquery

by in , 0

Today we are going to use jQuery and CSS3 rotations, along with the jQuery rotate plugin, to create a beautiful slideshow. You can use it to spice up your web sites, product pages and other projects with some CSS3 magic.



Read more »

Multi-Step Signup Form With CSS3 and jQuery

by in , , 0

In this tutorial we will see how to create a simple multi-step signup form using CSS3 and jQuery. To spice up things a bit, we will include progress bar with the form, so the users will be able to see the percentage of form completion.

You can take a look at the working demo if you click on the image below:

Create A Multi-Step Signup Form With CSS3 and jQuery DEMO
We will create four steps in our form:
1. username and password fields
2. first and last name and email address
3. age, gender and country
4. summary

Download Code

Related Posts sidebar with jQuery and CSS3 | Brighten up by Css series

by in 0

The other day we were wondering how we could show our visitors more of our works. It’s normal that in a blog older posts get forgotten and even if something might still be very interesting and relevant, it get’s lost under the pile of new stuff. So we decided to create something like a little widget that can be used to show related posts in any page. The main idea is to show a fixed list at the right side of the screen with some thumbnails sticking out. When the user hovers over the items, they slide out, revealing the title and two links, one for the related article itself and one for the demo. Additionally, we will have a shuffle button under the list. When pressed, the list gets randomly refreshed with related posts.
Before we use this, we of course, want to share it with you :)



Read more »

PHP Detect URL Protocol - http vs https

by in 0

I've written a little function to establish the current site url protocol but I don't have SSL and don't know how to test if it works under https. Can you tell me if this is correct?

function siteURL()
{
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
    $domainName = $_SERVER['HTTP_HOST'].'/';
    return $protocol.$domainName;
}
define( 'SITE_URL', siteURL() );
Is it necessary to do it like above or can I just do it like?:
function siteURL()
{
    $protocol = 'http://';
    $domainName = $_SERVER['HTTP_HOST'].'/'
    return $protocol.$domainName;
}
define( 'SITE_URL', siteURL() );
Under SSL, doesn't the server automatically convert the url to https even if the anchor tag url is using http? Is it necessary to check for the protocol?

Thank you!



Read more »

Create a nice CSS3 Progress bar without any images | Brighten up by Css series

by in , , 0

As I’ve shown you in some of my recent posts, the new features introduced in CSS3 allows developers to create stunning visual effects. Today, let’s create a fancy progress bar using CSS3 and jQuery, but no Flash or even images.

Please note: The original CSS3 progress bar shown in this tutorial has been created by Ivan Vanderbyl, which hereby gave me the right to reproduce and document his work.
The following tutorial and the demo works best on Chrome and Safari, correctly on Firefox and very badly in Internet Explorer (eh…I’m sure you hadn’t guessed that).

The Demo

Read more »

Draw a Vibrant Poster/Banner by CSS | Brighten up by Css series

by in , 0

CSS has come a long way in recent years, and with new browser support for a hand full of CSS3 properties we can begin to replicate design styles directly in the browser that beforehand were recently only possible in our design applications. Follow this walkthrough of the making of Circlicious, a vibrant and abstract digital poster design made purely of HTML and CSS.


View the CSS poster demo
The Circlicious poster art makes use of plenty of circular geometric shapes and features lots of transparency to add multiple levels to the design, giving the design that bright and crisp feel of typical vector artworks. Being a design that makes use of CSS3 properties, it’s only suited to the modern browsers of Firefox, Safari and Chrome.

Firefox, Safari & Chrome = Win. Opera… Meh. Internet Explorer… I wouldn’t even bother.

Read more »

Mini Navigation Menu | Brighten up by Css series

by in , 0

As you have probably heard by now, CSS3 animations are a powerful tool, which enables you to create animations which run without the need of applying additional scripting to the page. What is even better, in the next generation of browsers we will have even more powerful tools, including 3D transformations (already present in Safari).
But what difference does it make for us today? At the moment only three browsers give you the ability to animate CSS properties – Chrome, Safari and Opera, which together take up only a small part of the browser market. Firefox is expected to soon join the club, and with the impending release of IE9, it suddenly makes sense to start leveraging this technique.

So today we are making something practical – a simple CSS3 animated navigation menu, which degrades gracefully in older browsers and is future-proofed to work with the next generation of browsers.



DEMO:

Read more »

Nice Full page Menu | Brighten up by Css Series

by in , 0

In today’s tutorial we will create a full page cufonized menu that has two nice features: when hovering over the menu items we will move a hover-state item that adapts to the width of the current item, and we will slide out a description bar from the left side of the page, reaching towards the current menu item.
We will use jQuery for the effect and some CSS3 properties for the style. We are not going to use any images.



DEMO:

Read more »

Change highlight color with JQuery

by in 0

jQuery's highlight method will highlight any div with a yellow background.
How do I specify what color to use instead of yellow for highlight?

Answer:


$(this).effect("highlight", {color: 'blue'}, 3000);

HP Pavilion a255c drivers

by in , 0

Direct Download Drivers HP Pavilion a255c drivers


Index
Application
BIOS
Diagnostics
Firmware
Keyboard and Input Devices
Modem
Network
OS
Software
Sound Card
Update
Utility
Video Card

Category: Application
OS: Windows XP
Version: 1.05.002g
Date: 07 Jul 2003
Filesize: 1.95 MB
Download file

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Read more »

HP Pavilion a250y drivers

by in , 0

Direct Download Drivers HP Pavilion a250y drivers


Index
Application
BIOS
Diagnostics
Keyboard and Input Devices
Modem
Network
OS
Software
Utility

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Read more »

HP Pavilion a250n drivers

by in , 0

Direct Download Drivers HP Pavilion a250n drivers


Index
Application
BIOS
Diagnostics
Firmware
Keyboard and Input Devices
Modem
Network
OS
Software
Sound Card
Update
Utility
Video Card

Category: Application
OS: Windows XP
Version: 1.05.002g
Date: 07 Jul 2003
Filesize: 1.95 MB
Download file

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Category: Application
OS: Windows XP
Version: 5-27-2003
Date: 27 May 2003
Filesize: 0.93 MB
Download file

Read more »

HP Pavilion a250e drivers

by in , 0

Direct Download Drivers HP Pavilion a250e drivers


Index
Application
BIOS
Diagnostics
Keyboard and Input Devices
Modem
OS
Software
Utility

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Read more »

HP Pavilion a248.fr drivers

by in , 0

Direct Download Drivers HP Pavilion a248.fr drivers


Index
Utility

Category: Utility
OS: Windows XP
Version: N/A
Date: 10 Aug 2004
Filesize: 0.94 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 10 Aug 2004
Filesize: 2.23 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 11 Aug 2004
Filesize: 14.98 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 11 Aug 2004
Filesize: 37.14 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 11 Aug 2004
Filesize: 2.74 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 11 Aug 2004
Filesize: 2.75 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 11 Aug 2004
Filesize: 0.85 MB
Download file

Category: Utility
OS: Windows XP
Version: N/A
Date: 11 Aug 2004
Filesize: 0.86 MB
Download file

Read more »

HP Pavilion a245c drivers

by in , 0

Direct Download Drivers HP Pavilion a245c drivers


Index
Application
BIOS
Diagnostics
Firmware
Keyboard and Input Devices
Modem
OS
Software
Sound Card
Update
Utility
Video Card

Category: Application
OS: Windows XP
Version: 1.05.002g
Date: 07 Jul 2003
Filesize: 1.95 MB
Download file

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Read more »

HP Pavilion a235.uk drivers

by in , 0

Direct Download Drivers HP Pavilion a235.uk drivers


Index
Application
Diagnostics
Firmware
Keyboard and Input Devices
OS
Software
Sound Card
Update
Utility
Video Card

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Read more »

HP Pavilion a230n drivers

by in , 0

Direct Download Drivers HP Pavilion a230n drivers


Index
Application
BIOS
Diagnostics
Firmware
Keyboard and Input Devices
Modem
OS
Software
Sound Card
Update
Utility
Video Card

Category: Application
OS: Windows XP
Version: 1.05.002g
Date: 07 Jul 2003
Filesize: 1.95 MB
Download file

Category: Application
OS: Windows XP
Version: 1.4.2_03
Date: 11 Dec 2003
Filesize: 12.27 MB
Download file

Category: Application
OS: Windows XP
Version: 5-27-2003
Date: 27 May 2003
Filesize: 0.93 MB
Download file

Read more »