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 »