Categories
Uncategorized

Get more touchy with IE 11

As a part of Windows 8.1 preview, Microsoft has included the Internet Explorer 11 preview as well. In this preview release there have been major upgrades as far as the Touch Interface section goes. The new Internet Explorer promises a better touch performance, faster page load times, a continuous browsing experience across your Windows devices, and completely rebuilt F12 developer tools.

Check the  compatibility of your Browser with the Levitation demo here.

Immersive Browsing

It also promises a fast user experience with as many tabs open as you want. The speciality of this new updated version is that you can have side-by-side browsing, i.e., while viewing your favourite site you can also view Windows Store apps. IE11 adds support for accessing tabs open across your devices, kept in sync through the cloud with SkyDrive.

Touch Optimized

Best browser touch responsiveness and battery life on Windows devices:
Using gestures such as panning, zooming, and swiping, the Internet Explorer 11 produces “Stick to your Finger” touch responsiveness using the GPU. It also priortizes work by prefetching content in the background.

Touch optimized address bar: Get to your most frequently used sites quickly, always fresh and up to date with the browsing you do across all your devices.

As many tabs as you want: Up to 100 tabs per window, with independent tab suspension for efficient use of memory and battery, and faster switching with tabs that are there when you need them, out of your way when you don’t.

More beautiful, touchable favorites: Full support for Favorite sites with folders and custom tile pictures that are more personal and always stays in sync with the desktop and across all your Windows 8.1 PCs.

Swipe for Browsed Pages: Now you can swipe forward or backward to go the previous page and forward page. This feature will be most appreciated by all.

Support for Next Generation Sites & Apps

Check your Browser’s compatibility with the above site here.

Developers can build next generation experiences with professional-quality Web video, and hyper-fast 2D and 3D Web technologies that make the most of the underlying hardware.
Few other major improvements in this aspect are:

  • Create live site tiles in the Windows 8.1 Start Screen.
  • Modern Web development is easier.
  • Hardware-accelerated 3D Web graphics.
  • The existing Web continues to work – even better.
  • Enable professional-quality video experiences on the Web.
  • Build Windows apps that deliver world class Web content.

So, if you want to see this for yourself, then you must download and install Windows 8.1 Preview from here.

Categories
Uncategorized

3 Best WordPress Quote Plugins

I’ve been looking for some plugins, that would help WordPress users to display quotes on their Sites for quite some time now and I’ve found these 3 Plugins to be the best out there. Here are the details for you:

1) Perfect Quotes

An easy to use plugin for quotes and testimonials! It integrates easily using a widget or shortcode. It does quotes perfectly!

This plugin gives you the freedom to add quotes or testimonials to your site without having to connect to an external source for quotes. If you want to add a new quote, do just that, add a new quote. No more letting other people say your quotes for you. If you want to give your customers testimonials, this is a great plugin to do that, too!

Features

  • Widget based to easily place your quotes where you like.
  • A custom shortcode is included if you want to place your quotes within a post or a page.
  • Based on Custom Post types with its own admin menu.

Support languages

  • PHP
  • CSS
  • jQuery/javascript

2) Quotes Collection

 Quotes Collection plugin with Ajax powered Random Quote sidebar widget helps you collect and display your favourite quotes in your WordPress blog.

Quotes Collection plugin helps you collect, manage and display your favourite quotations in your WordPress blog.

Features and notes

  • Admin interface: An admin interface to add, edit and manage quotes. Details such as author and source of the quote, and attributes like tags and visibility, can be specified. The ‘Quotes’ menu in the WP admin navigation leads to the quotes admin interface.
  • Sidebar widget: The Random Quote sidebar widget with Ajax refresh feature — you will be able to get another random quote on the same space without refreshing the web page. Following is the list of options in the widget control panel:
    • Widget title
    • Option to show/hide quote author
    • Option to show/hide quote source
    • Turn on/off the ajax refresh feature
    • Choose random or sequential order for refresh
    • Option to refresh the quote automatically
    • Show only quotes with certain tags
    • Specify a character limit and filter out bigger quotes
  • Shortcode: Quotes can be displayed in a WordPress page by placing a[quotcoll]shortcode. Few examples are provided below.
    • Placing [quotcoll] in the page displays all quotes.
    • [quotcoll author="Somebody"] displays quotes authored by Somebody.
    • [quotcoll tags="tag1,tag2,tag3"] displays quotes tagged tag1 or tag2 or tag3, one or more or all of these
    • [quotcoll orderby="random" limit=1] displays a random quote
  • The template function: To code the random quote functionality directly into a template file, the template function quotescollection_quote()can be used. Please refer the plugin homepage or ‘other notes’ for details.
  • Compatible with WordPress 3.0 multi-site functionality.
  • The plugin suppports localization. Refer the plugin page or ‘other notes’ for the full list of available languages and the respective translators.

3) Flexi Quote Rotator

 

A plugin for displaying quotes or testimonials or other rotating snippets of content.

The flexi quote rotator plugin allows you to add quotations/testimonies to your site using a shortcode or php snippet in template or as a widget. Includes an administration settings page and provides styling flexibility.

You can use this plugin to display quotes or testimonials or other rotating snippets of content on your web site. The quotes are entered in the admin area and can be displayed using a widget, a shortcode or php snippet. The quotes will rotate with a fade transition on each changeover.

Out of these 3 quote Plugins for WordPress, if you ask me what my favorite is then I’d pick Perfect Quotes as I love it. If you have any queries regarding this, then please feel free to comment below.

Categories
Uncategorized

Edit WordPress RSS Title

To edit the WordPress RSS Title in your Blog feeds, you can follow two methods. One method is to edit the feed’s title on your host itself and the other is to edit the title in the Feedburner. I personally prefer method one, as it can be tweaked according to one’s comfort levels.
wordpress rss

Method 1

You will have to use your online File Manager or an FTP client like FileZilla to implement this. method. Log in to your hosting account and then download the files included in the following path:
/public_html/wp-includes/

Download the following files to your computer if you want edit them using a text editor like Notepad, Adobe Dreamweaver, etc. You can also choose to edit these files online using the Edit option in the online File Manager of your Hosting account.

feed-rss.php
feed-rss2.php
feed-rss2-comments.php
feed-atom.php
feed-atom-comments.php
feed-rdf.php

After opening the above files search for the following snippets of code like:

<title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>

(or)

<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>

 

You will find this code at or around the 19th line. Now you have to change the title attribute by either commenting out the PHP codes or by deleting them and then, adding your own custom made title.  Then it will seem somewhat like the below code:

<title type="text"><?php /*bloginfo_rss('name');  wp_title_rss(); */?>THIS IS YOUR TITLE</title>

(or)

<title><?php /*bloginfo_rss('name'); wp_title_rss(); */ ?>THIS IS YOUR TITLE</title>

 

You might also find the title code like the following in the above files, and in the same way as above you have to comment it out or remove it and replace it with your own Title:

<?php
		if ( is_singular() )
			printf( <span class="hiddenSpellError" pre=""-->ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
		elseif ( is_search() )
			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
		else
			printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) . get_wp_title_rss() );
	?>

You can change it to the following by commenting out the second title given above:

<?php
		if ( is_singular() )
			printf( <span class="hiddenSpellError" pre=""-->ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
		elseif ( is_search() )
			printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
		else
			printf( ent2ncr( __( 'Comments for %s' ) ), get_bloginfo_rss( 'name' ) /* . get_wp_title_rss() */ );
	?>

Hope you found this method easy to understand and impliment, cause you din’t then there’s an even more easier way to get around this.

 

Method 2

The method 2 as mentioned above is quite easy and you can do it without editing any sort of code. All you need to do is login to your Feedburner account and then click on the Feed you want to burn and then go to Optimize option in the tabs given. To the left in your SERVICES pane, you will have an option that says Title/Description Burner. You can enter your own title that replaces your blog title provided in the feeds and you are also allowed to enter the description of your wish.

feedburner

 

The option Edit Feed Details above the Optimize tab in your Feedburner window, isn’t of much use in the above case as it is used only to edit the title of your Feed inside Feedburner Interface itself.
feedburner

If you have any queries regarding this, then please feel free to mention them in the comment section below.

Categories
Uncategorized

Disable Hotlinking using htaccess to stop Bandwidth Theft without effecting your Feeds!

Hotlinking has to be disabled because when you are not an Unlimited Hosting Plan, or else this will surely effect the performance of your site. In the method depicted below you just have to add the extensions of the files that you want to prevent from hotlinking to the code given below. For example, if you want to prevent videos hosted on your site to be hotlinked, then you will have to add the extension of the video file type like mp4 or avi to the code after the gif extension.

Add the code shown below to your .htaccess file to prevent your images from being hotlinked. Just change the line that says ^http(s)?://(www\.)?thecollegestash.com [NC] according to your site URL and you are done. This method does not cause your Feeds from Feedburner to stop functioning by not displaying images from your site. The code listed below is the same as the code I use on this Site. It encourages almost all the social networking sites popular today like facebook, pinterest, etc to hotlink my images.

#Image hotlinking Protection [theCollegeStash.com]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?thecollegestash.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !msn\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feedburner.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?msn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?facebook.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?pinterest.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bloglines.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feedly.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?netvibes.com/.*$ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
#Image hotlinking Protection [theCollegeStash.com]

The .htaccess file is located in your root Directory. You have to download it to your system and then edit it using a text editor like Notepad and then Save the changes and upload the file back to the root Directory, replacing the original file.

There are other ways to prevent hotlinking  like installing the following plugin:
Configurable Hot Link Protection

Display your Image on the Stealer’s Site

Adding code to your .htaccess file is the best method as far as I’m concerned as you can add custom functionality through the code. You can display a custom image like the following embarrassing image when your bandwidth is stolen.
You can display any custom image like the above one, when someone steals your Bandwidth. For that to happen, all you need to do is replace the URL in the code below with the URL of the image you want to display and add this piece of code into your.htaccess file in place of the last line already given in the code above.

RewriteRule \.(jpg|jpeg|png|gif)$ http://hpmouse.googlepages.com/hotlink.gif [NC,R,L]
#Hotlinking Protection [theCollegeStash.com]

Please keep note that any small error in the .htaccess file could lead to your site crashing in a few moments, which ofcourse will need your immediate attention. If you have any queries regarding this topic then please feel free to reach me through the comments section below.

Categories
Uncategorized

Android apps using Apache Cordova

Making native Android apps requires some basic knowledge of Java and it takes some time to learn. But you can use your HTML 5, CSS3,
and Js knowledge to make native Android apps using Apache Cordova, an open source initiative from Apache, Mozilla and Adobe.

Using Apache Cordova, you can access the Android APIs to access native device capabilities such as the camera, accelerometer, NFC beam, Bluetooth from JavaScript. Apache Cordova has a great Js library which is easy to implement in the apps.

Making your First app with Apache Cordova

To start developing apps for Android using Apache Cordova, you need to go through the list of requirements :

  • Latest version of Java RE
  • Latest version of JDK
  • Android Studio
  • Latest Cordova SDK

Installing up Android Studio

Download the latest version of Android Studio from Android Developer site. Android Studio is available for different operating systems like Linux, Mac OSX and Windows. The setup file has all the dependents like Android SDK, emulator, Device Bridge. Install the Android Studio setup and Android Studio is ready to use.

Installing Cordova SDK

Now download the latest Cordova SDK from the Apache site. Extract the downloaded file and we will use it later.

Creating the project in Android Studio

Follow these steps to create a project in Android Studio

    • Open the Android Studio
    • Select New Project
  • Enter the required name of the project
  • Select the required icon from the explorer
  • Select Blank activity
  • Select Finish
  • A blank project is created.

Configuring Project to Cordova

  • Now create two blank folders assets/www and libs inside the Andorid project directory
  • Go to the downloaded Cordova folder
  • Now copy the corodova-”version”.jar file to libs folder in Android project folder
  • Copy the corodova-”version”.js file to assets/www folder in Android project folder
  • Next, create a file named index.html in the assets/www. This file will be used as the main entry point for your Cordova application’s interface.
  • In index.html, add the following HTML code to act as a main part for your app content
<!DOCTYPE HTML>
<html>
 <head>
  <title>Cordova</title>
  <script type="text/javascript" charset="utf-8" src="cordova-2.7.0.js"></script>
 </head>
 <body>
    <h1>Hello World!</h1>
 </body>
</html>

Hello World!

  •  You need to add the Cordova.jar file as library file.
  • Go to libs file in Android Studio, right click the Cordova.jar file and select Add as library.

Update the activity class

Now you are ready to update the Android project to start using Cordova

  • Open your main application Activity file. This file will have the same name as your project, followed by the word “Activity”. It will be located under the src folder in the project package that you specified earlier in this process.
  • In the main Activity class, add an import statement for org.apache.cordova.MyApplication
import org.apache.cordova.MyApplication;
  •  Change the base class from Activity to MyApplication ; this is in the class definition following the word extends :
public class HelloGapActivity extends MyApplication {
  •  Replace the call to setContentView() with a reference to load the Cordova interface from the local assets/www/index.html file, which you created earlier
super.loadUrl("file:///android_asset/www/index.html");

Configure the project metainfo

  • Begin by opening the AndroidManifest.xml file in your project root. Use the Notepad++ text editor by right-clicking the AndroidManifest.xml file and selecting Open With > Text Editor
  • In AndroidManifest.xml, add the following supports-screen XML node as a child of the root manifest node:
<supports-screens
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:resizeable="true"
    android:anyDensity="true"
    />
  •  The supports-screen XML node identifies the screen sizes that are supported by your application. You can change screen and form factor support by altering the contents of this entry.
  • Copy the following <uses-permission> XML nodes and paste them as children of the root <manifest> node in the AndroidManifest.xml file:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />

The <uses-permission> XML values identify the features that you want to be enabled for your application. The lines above enable all permissions required for all features of Cordova to function. After you have built your application, you may want to remove any permissions that you are not actually using; this will remove security warnings during application installation.

After you have configured application permissions, you need to modify the existing <activity> node.

  • Locate the <activity> node, which is a child of the <application> XML node. Add the following attribute to the <activity> node:
android:configChanges="orientation|keyboardHidden"
  •  Next, you need to create a second <activity> node for the org.apache.cordova.MyApplication class. Add the following <activity> node as a sibling of the existing <activity> XML node:
<activity 
    android:name="org.apache.cordova.MyApplication" 
    android:label="@string/app_name" 
    android:configChanges="orientation|keyboardHidden"> 
    <intent-filter></intent-filter> 
</activity>

Now the project is ready to build your first Android app.

Running the application

To launch your Cordova application in the emulator, right-click the project configuration, and select Run As > Android Application.

If you don’t have any Android virtual devices set up, you will be need to configure it.

Andorid Studio will have preinstalled emulator configuration so there will hardly be any program.

Download the source code of the above tutorial at github.com/saivarunk/example

Categories
Uncategorized

Migrate from MySQL to MySQLi & vice versa

There have been many questions on how to migrate from MySQL to MySQLi. Well adding the letter i to mysql wouldn’t solve the problem while you are migrating. There is a change in the method of query. First of all you need to have a basic knowledge of MySQL to follow this post.

MySQL – Create a Table

$table = "CREATE TABLE IF NOT EXISTS Users (
		 		 id int(11) NOT NULL auto_increment,
				 username varchar(255) NOT NULL
                                            )";

mysql_query($table);

MySQLi – Create a Table

$link = mysqli_connect("localhost","username","password", "databasename");
$table = "CREATE TABLE IF NOT EXISTS Users (
		 		 id int(11) NOT NULL auto_increment,
				 username varchar(255) NOT NULL
                                            )";
$query = mysqli_query($link, $table);

The same $link has to be passed whenever you are using the MySQLi type mysqli_query()command. For example when you are using commands like INSERT, SELECT,  DELETE,etc you have to pass the $link parameter shown above. The mysqli_query() defaultly expects two parameters to be passed. One is the $link paramter which connects to the database and the other is the query operation.

In case you do not provide the $link parameter in your query, then you will get an error like this while processing your page:
mysqli_query() expects at least 2 parameters

Also read: MySQL vs MySQLi which is better and What’s the difference – Explained!

Now moving onto other MySQL commands, like mysql_real_escape_string() the change in the MySQLi format can be seen below.

$demo = mysql_real_escape_string($email1);
$demo = mysqli_real_escape_string($link, $email1);

If the $link parameter isn’t passed through the mysqli_real_escape_string() then you will see the following error when you go to your page:
mysqli_real_escape_string() expects exactly 2 parameters

the mysql_error() command in MySQL and it’s equivalent in MySQLi can be seen below:

mysql_error();

 

mysqli_error($link);

If you do not pass the $link parameter then you are likely to see the following error:
mysqli_error() expects exactly 1 parameter, 0 given

the mysql_num_rows() command in MySQL and it’s equivalent in MySQLi can be seen below:

$sql = mysql_query("SELECT username FROM Users WHERE username='admin'"); 
$check = mysql_num_rows($sql);
$sql = mysqli_query($link, "SELECT username FROM Users WHERE username='admin'"); 
$check = mysqli_num_rows($sql);

the mysqli_fetch_array() command in MySQL and it’s equivalent in MySQLi can be seen below:

$sql = mysql_query("SELECT id, username, firstname, lastname FROM myMembers WHERE id='123' LIMIT 1");
$row = mysql_fetch_array($sql);
$sql = mysqli_query($link, "SELECT id, username, firstname, lastname FROM myMembers WHERE id='123' LIMIT 1");
$row = mysqli_fetch_array($sql);

So these are the major differences between MySQL and MySQLi commands. Hope you will find it easy to migrate from MySQL to MySQLi using these. The MySQLi commands are all in precedural form instead of Object-Oriented Style. If you have any queries regarding this process then please feel free to reach me through the comment section.

Categories
Uncategorized

MySQL vs MySQLi which is better and What’s the difference – Explained!

There has been a huge discussion over the internet about using MySQL or MySQLi in their PHP code. Before getting to that part, one must have a basic knowledge of it, so lets get started on it. To start off with, there are three main API options when considering connecting to a MySQL database server. They are,

  • PHP’s MySQL Extension
  • PHP’s mysqli Extension
  • PHP Data Objects (PDO)

Of course each of them have their own set of advantages and disadvantages.

What is PHP’s MySQL Extension?

This is the original extension designed to allow you to develop PHP applications that interact with a MySQL database. The mysql extension provides a procedural interface and is intended for use only with MySQL versions older than 4.1.3. This extension can be used with versions of MySQL 4.1.3 or newer, but not all of the latest MySQL server features will be available.

If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use the mysqli extension instead.

In the PHP installation on the remote server or local server, the mysql extension source code is located in the PHP extension directory ext/mysql.

 

What is PHP’s mysqli Extension?

The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.

The mysqli extension has a number of benefits, the key enhancements over the mysql extension being:

  • Object-oriented interface
  • Support for Prepared Statements
  • Support for Multiple Statements
  • Support for Transactions
  • Enhanced debugging capabilities
  • Embedded server support

If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use this extension.

Along with the object-oriented interface the extension also provides a procedural interface.

The mysqli extension is built using the PHP extension framework, its source code is located in the directory ext/mysqli in the PHP installation in the remote server or local server

I personally use MySQLi extension in my projects as i feel it has future use and it can be used in both Object-Oriented Style and Procedural Style. The official website for PHP itself states reasons for opting the MySQLi extension.

Read about: Migrate from MySQL to MySQLi & vice versa

Why MySQLi?

The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.

The persistent connection of the mysqli extension however provides built-in cleanup handling code. The cleanup carried out by mysqli includes:

  • Rollback active transactions
  • Close and drop temporary tables
  • Unlock tables
  • Reset session variables
  • Close prepared statements (always happens with PHP)
  • Close handler
  • Release locks acquired with GET_LOCK()

This ensures that persistent connections are in a clean state on return from the connection pool, before the client process uses them.

The mysqli extension does this cleanup by automatically calling the C-API function mysql_change_user().

The automatic cleanup feature has advantages and disadvantages though. The advantage is that the programmer no longer needs to worry about adding cleanup code, as it is called automatically. However, the disadvantage is that the code could potentially be a little slower, as the code to perform the cleanup needs to run each time a connection is returned from the connection pool.

It is possible to switch off the automatic cleanup code, by compiling PHP with MYSQLI_NO_CHANGE_USER_ON_PCONNECT defined.

For more information regarding MySQL, you can visit their official website here.
If you have any queries regarding this topic then please feel free to reach me through the comment section below.4