How To Create an IE-Only Stylesheet


Source : http://css-tricks.com/how-to-create-an-ie-only-stylesheet/

Advertisements

Making your WordPress Plugin Responsive by using AJAX


Source: http://designmodo.com/responsive-wordpress-plugin/#ixzz2NOIiUKzv

Traditionally whenever you click a link on a web page it might do a request on the server for that URL and the complete page will be fetched from the server. This is fine in some cases but in some cases it is too time consuming for the whole page to load. There might not be much difference in the content of the page as many sections like the header, footer; sidebars might just be the same.

You can make your websites more responsive by using AJAX (Asynchronous JavaScript and XML). By using AJAX in your website and plugins you will not refresh the complete page. You will just get the content from the server which you want to update and only update that part of the page. So the complete reload of the pages does not remain necessary and you website seems much more responsive to the user. WordPress also has good support for AJAX. This makes it very easy to write plugins which use AJAX in them.

In this article we are going to see how to use AJAX in your plugin by writing a simple plugin which list the latest posts titles and then by clicking on the post title will fetch the contents of the post via an AJAX call.

Adding the necessary files and scripts

Let’s start by creating the plugin and adding some necessary scripts which will be necessary for our plugin to function.

First create a directory ajaxloadpost in you plugins directory of WordPress installation. In it create ajaxloadpost.php with the following content for the header of your plugin.

1
2
3
4
5
6
7
<?php
/*
Plugin Name: Ajax Load Post
Description: This loads post via ajax
Author: Abbas Suterwala
Version: 1
*/

Now you should be able to see your plugin in the plugin list, you should go and activate it.

Once you have activated the plugin you should also add the following code to your ajaxloadpost.php

1
2
3
4
5
6
define('AJAXLOADPOSTURL', WP_PLUGIN_URL."/".dirname( plugin_basename( __FILE__ ) ) );
function ajaxloadpost_enqueuescripts() {
    wp_enqueue_script('ajaxloadpost', AJAXLOADPOSTURL.'/js/ajaxloadpost.js', array('jquery'));
    wp_localize_script( 'ajaxloadpost', 'ajaxloadpostajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
}
add_action('wp_enqueue_scripts', ajaxloadpost_enqueuescripts);

In the above code we first we define a variable AJAXLOADPOSTURL which holds the URL to our plugin directory. We will use it wherever we need to point to the URL of our plugin.

Then we add the function ajaxloadpost_enqueuescripts too the wp_enqueue_scripts action of WordPress. This will help us enqueue the necessary scripts.

First we add our JavaScript file ajaxloadpost.js which should be in \wp-content\plugins\ajaxloadpost\js\ folder.

So now you should create the js folder and put the ajaxloadpost.js file in it.

The WordPress function wp_enqueue_script will enqueue this script for us and it also specifies that jquery is the prerequisite for this. Then we add a JavaScript variable using the WordPress function wp_localize_script which holds the WordPress AJAX URL which we get using the function admin_url( ‘admin-ajax.php’ ) ).

So finally you directory structure will be as follows and your scripts will be enqueued by WordPress.

Adding the AJAX handler in WordPress

Now let’s write our AJAX handler which will be the function which will handle when we make an AJAX call to WordPress. The code for our AJAX handler is as follows.

1
2
3
4
5
6
7
8
9
10
11
12
13
function ajaxloadpost_ajaxhandler() {
    if ( !wp_verify_nonce( $_POST['nonce'], "ajaxloadpost_nonce")) {
        exit("Wrong nonce");
    }
    $results = '';
    $content_post = get_post($_POST['postid']);
    $results = $content_post->post_content;
    die($results);
}
add_action( 'wp_ajax_nopriv_ajaxloadpost_ajaxhandler', 'ajaxloadpost_ajaxhandler' );
add_action( 'wp_ajax_ajaxloadpost_ajaxhandler', 'ajaxloadpost_ajaxhandler' );

The above function assumes two inputs to it. One is the post id of the post whose content we want to fetch and second is the ‘nonce’ (this we will discuss in a separate section below).

This function first checks if the nonce is appropriate. Once that is done it gets its gets the posted from the $_POST variable. The using the WordPress API get_post we get the post via the post id and gets its content. And then we die by passing the contents back.

Once we have got our AJAX handler function in place now we need to register it with WordPress so that our function can be called once we make an AJAX request for it. We can do it by adding our function to the following actions.

1
2
add_action( 'wp_ajax_nopriv_ajaxloadpost_ajaxhandler', 'ajaxloadpost_ajaxhandler' );
add_action( 'wp_ajax_ajaxloadpost_ajaxhandler', 'ajaxloadpost_ajaxhandler' );

So now when an AJAX request is done to WordPress’s admin-ajax.php url with the action parameter as ajaxloadpost_ajaxhandler our function will be called.

The Javascript  for AJAX

Now let’s write the JavaScript function which will make the AJAX call for us and update the data which is returned by our AJAX handler. The function should be put in ajaxloadpost.js and is as follows.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function ajaxloadpost_loadpost(postid,nonce) {
    jQuery.ajax({
        type: 'POST',
        url: ajaxloadpostajax.ajaxurl,
        data: {
            action: 'ajaxloadpost_ajaxhandler',
            postid: postid,
            nonce: nonce
        },
        success: function(data, textStatus, XMLHttpRequest) {
            var loadpostresult = '#loadpostresult';
            jQuery(loadpostresult).html('');
            jQuery(loadpostresult).append(data);
        },
        error: function(MLHttpRequest, textStatus, errorThrown) {
            alert(errorThrown);
        }
    });
}

This function takes two inputs the post id and the nonce. Then using the jQuery.ajax function we will make the AJAX call to the server. The URL is the WordPress AJAX URL of admin-ajax.php which we had stored in the JavaScript variable when enququing the scripts. Then we specify the action as the name of the action handler we registered with WordPress and post the post id and nonce.

In case of success we update the <div> of id #loadpostresult with the content returned by the AJAX handler. In case of error we just pop up the error.

Displaying the list of posts

Once we have put all these functions in place now let’s display the post title and then depending on the post which is clicked lets fetch the content for it with an AJAX call.

The code to do this as follows.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function ajaxloadpost_show_latest_posts($number = '5'){
    $results ='';
    $the_query = new WP_Query( 'posts_per_page='.$number );
    while ( $the_query->have_posts() ) :
        $the_query->the_post();
        $nonce = wp_create_nonce("ajaxloadpost_nonce");
        $arguments =  get_the_ID().",'".$nonce."'";
        $link = ' <a onclick="ajaxloadpost_loadpost('.$arguments.');">'. get_the_title().'</a>';
        $result.= '<li>' . $link . '</li>';
    endwhile;
    wp_reset_postdata();
    $result.=  '<div id="loadpostresult"></div>';
    return $result;
}
function ajaxloadpost_shortcode_function( $atts ){
    return ajaxloadpost_show_latest_posts();
}
add_shortcode( 'AJAXLOADPOST', 'ajaxloadpost_shortcode_function' );

In the function ajaxloadpost_show_latest_posts I do a query to get the latest post and loop over them to put all the titles in an <a> tag which call our JavaScript function ajaxloadpost_loadpost passing it the post id and nonce. It also adds an empty <div> which will be filled with the result from the AJAX handler.

I have also created a shortcode so that we can use it in a page. In case all is gone well you can add a shortcode [AJAXLOADPOST] in a page as see the post as follows.

Now clicking on the hello world post will fetch the content of it as follows.

A note on nonces

Nonces are basically used to check if the request is come from a genuine source. We generate the nonce using the WordPress function wp_create_nonce. Then this nonce is checked in our AJAX handler using the WordPress function wp_verify_nonce.

This is really important in case you are doing some sensitive task in your AJAX handler. You should always check nonces in your AJAX handler.

Conclusion

AJAX when used appropriately can make your site really responsive to use. WordPress makes it easy by receiving the AJAX call and passing it to our handler. We can easily write our logic and fetch the data which we want to return back to be updated on the front end. So have fun in using AJAX in your next plugin.

Gallery

Know the WordPress Theme and the File Structure

This gallery contains 1 photo.


Source: http://designmodo.com/wordpress-theme-structure/#ixzz2NOHkLNal WordPress has clear distinction between the functionality of the site that is the different features you have on your site and the way the site is displayed to the user. The appearance of the WordPress site to the … Continue reading

How To: Avoid Duplicate Posts


The Codex article the reader mentioned was regarding the Loop. Although the example shows how to avoid a single duplicate post, it doesn’t show how to avoid duplicating multiple posts.

Here’s how to show two individual loops without duplicating posts in either loop.

Step 1: Add a ‘posts_where’ Function

WordPress filter is needed to accomplish this, and we’re going to be tapping into the ‘posts_where‘ filter.

The reason being is we need to modify the query used for the loop and exclude some posts.

Here’s the function we’ll be using called post_strip:

 

function post_strip($where) {
	global $myPosts, $wpdb;
	$where .= " AND $wpdb->posts.ID not in($myPosts) "; 
	return $where;
}

 

In the above code, I use a global variable called $myPosts, which is comma-separated string of post IDs to exclude.

Step 2: Start the First Loop

Within this first loop we’ll be keeping track of the post IDs being used. Nothing fancy is being done here. We’re just pulling the last five posts posted.

 

<?php 
global $myPosts;
$myPosts = '';
?>
<div>
<?php
$my_query = new WP_Query();
$my_query->query('showposts=5');
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php $myPosts .= $post->ID . ","; ?>
<div><?php the_title(); ?></div>
<!-- Post Stuff -->
<?php endwhile; endif; ?>
</div>

 

Pay special attention to the $myPosts variable, which is used to keep track of all of the post IDs.

Step 3: Add the Filter

We’ll now need to add a posts_where filter for the second loop. This filter will use thepost_strip function we started in Step 1.

 

<?php add_filter('posts_where', 'post_strip'); ?>

 

Step 4: Start the Second Loop

The second loop is a repeat of the first loop to demonstrate that the posts are not being duplicated. The second loop uses a different loop technique since paging isn’t necessary.

 

<div>
<?php
$my_query = new WP_Query('showposts=5');
while ($my_query->have_posts()) : $my_query->the_post();?> 
<div><?php the_title(); ?></div>

<!-- Post Stuff -->

<?php endwhile; ?>
</div>

 

Step 5: Remove the Filter

The filter we added in Step 3 now needs to be removed.

 

<?php remove_filter('posts_where', 'post_strip'); ?>

 

Step 6: Admire the Results

Before Duplicates Being Shown
Before – Duplicates Being Shown

After - Duplicates Removed
After – Duplicates Removed

Downloadable Code

Here is a sample index.php for download.

 

Ref : http://weblogtoolscollection.com/archives/2008/05/17/how-to-avoid-duplicate-posts/

How do I write a Technical Specification document for my software project?


1 INTRODUCTION 8
1.1 Contractual 8
1.2 Purpose of the Document 8
1.3 Scope of the Software 8
1.4 Definitions, acronyms and abbreviations 8
1.5 References 9
1.6 Overview of the document 9

2 LOGICAL MODEL DESCRIPTION 11

3 SPECIFIC REQUIREMENTS 13
3.1 Functional requirements 13
3.1.1 User input interface (SR 1) 13
3.1.2 User output interface (SR 2) 13
3.1.3 Geantino source definition – particle sampling (SR 3) 13
3.1.4 Particle tracking (SR 4) 15
3.1.5 Histogramming of data (SR 5) 15
3.1.6 Geometry description (SR 6) 16
3.1.7 Run repetition (SR 7) 16
3.2 Performance requirements (SR 8) 16
3.3 Interface requirements (SR 9) 16
3.4 Operational requirements (SR 10) 16
3.5 Verification requirements (SR 11) 16
3.6 Acceptance testing requirements (SR 12) 16
3.7 Portability requirements 16
3.7.1 Platform, operating system and compiler (SR 13) 16
3.7.2 Portability to other platforms (SR 14) 17
3.8 Quality requirements (SR 15) 17
3.9 Maintainability requirements (SR 16) 17
3.10 Other requirements

4 SYSTEM DESIGN 18
5 COMPONENT DESCRIPTION 20
5.1 main 20
5.1.1 Type 20
5.1.3 Interfaces 20
5.1.4 Dependencies 20
5.1.5 Data 20
5.1.6 Resources 20
5.1.7 Software requirements met 20
5.2 MyGeometryConstruction 20
5.2.1 Type 20
5.2.2 Functions 21
5.2.3 Interfaces 21
5.2.4 Dependencies 21
5.2.5 Data 21
5.2.6 Resources 21
5.2.7 Software requirements met 21

...
...

6 USER REQUIREMENTS VERSUS SOFTWARE REQUIREMENTS TRACEABILITY
MATRIX 38
7 SOFTWARE REQUIREMENTS VERSUS COMPONENTS TRACEABILITY MATRIX
41

Ref : http://reat.space.qinetiq.com/ssat/docs/ssat_ssd.pdf

jQuery Plugins of the Day


jQuery Plugins of the Day

fresherEditor : jQuery Rich html text editor
http://www.jqueryrain.com/2013/02/freshereditor-jquery-rich-html-text-editor/

Fancy News – jQuery plugin
http://www.jqueryrain.com/2013/02/fancy-news-jquery-plugin/

Jribbble : A jQuery Plugin for the Dribbble API
http://www.jqueryrain.com/2013/02/jribbble-a-jquery-plugin-for-the-dribbble-api/

scrollNav : jQuery plugin for building a scrolling Side Nav
http://www.jqueryrain.com/2013/02/scrollnav-jquery-plugin-for-building-a-scrolling-side-nav/

 

 

Could not use move tool because the target channel is hidden


I had a problem I encountered a while ago when I’m doing a web design project in the Adobe Photoshop cs5 and a pop-up message said “Could not use move tool because the target channel is hidden“.  If you encounter this message then you are guilty by pressing the “Q” when you clicked the “Layer“, this option is what you called  ”Edit in Quick Mask Mode“. see the image below.

Solutions:

To resolve the probelm is simply by clicking any Layer>then press “Q” or

Go to Select menu>click “Edit in Quick Mask Mode” to uncheck.

Hope it will help! Enjoy!!

 

Source : http://www.lee-agosila.com/blog/could-not-use-move-tool-because-the-target-channel-is-hidden/

Download youtube video in mobile both pc


there are many people asking how download youtube video download in mobile easy using best browser
opeamini and uc beowser  both chrome and firefox also can be used just simple fallow the instraction
edit your youtube video url examlpe this is my url you can see   http://www.youtube.com/watch?v=4xZWxnx9sXw  that can be edit are add just ss just like this http://ssyoutube.com/watch?v=4xZWxnx9sXw   you will get download link select  format of a video 3gp video and mp4 also be supported nokia s40 and s60 also work enjoy

Seven WordPress Hacks for Bloggers


There are tons of awesome blogging platforms to consider, but WordPress is definitely one of the most popular content management systems out there – and with good reason. It’s easy to use and easy to customize, even if you’re a beginner.

But as you begin to use it more and more, you start learning little tricks. I’ve stumbled upon some fantastic time-savers that make me almost want to scream, “WHY DID NO ONE TELL ME THIS SOONER?!?!”

So I’m going to tell you these things, and I apologize for not telling you sooner! Experiences users, hopefully you still find a gem or two in here, and please leave your own favorite hack with a comment below!

1. Expand to Fullscreen for Easier Typing

Let’s start out with a simple tip, but one I didn’t realize was an option until well into my blogging career. It can be annoying to type a post in such a small box. First and foremost, if you scroll to the bottom of the left-hand sidebar when signed into your blog and editing a post, you’ll see “collapse menu.” Click on this text to get rid of that sidebar (don’t worry – you can easily get it back). It’s instantly a little more space. But an even better option is WordPress’ Fullscreen Mode.

There are actually two fullscreen modes. If you click the button that looks like a, square with arrows pointing at the corners (see picture), you’ll get a full screen mode with limited button options for easy, quick typing. If you press Alt+Shift+G you’ll get a version with the full bar of buttons for easier formatting. Both are great, especially if you’re working with a lot of pictures or block quotes.

2. Use Windows Live Writer for Formatting

How your final post looks will depend on the WordPress theme you’re using. You can continuously preview using WordPress itself, but that can be a little tedious, especially if you’re working with pictures and trying to get things to line up just right. Instead, download a desktop client to make formatting easy. I use Windows Live Writer (Mac fans, help me out with a comparable version?), which I like because I can sync it with all the blogs I have. As long as you keep it updated, you can use the WYSIWYG editor to add posts and see what they’ll look like on your blog when published. Adding pictures and videos is super easy.

3. Install a Maintenance Mode Plugin

Sometimes, you have to do some major updates that will cause you blog to look crummy for a few hours. Rather than scaring users away, download and install a plugin like Maintenance Mode and your readers will get a simple message that you’re working on your blog at the moment. I like this plugin specifically because you can even choose to include a countdown clock that will tell users when you get back. No coding knowledge necessary!

There are other maintenance mode plugins out there; this is just the one I like to use on my personal blog. Of course, you can also manually point code your site to give users a maintenance message, but who has the time/knowledge/ambition to do that? This makes it super easy!

4. Use Zemanta for Easy Linking

Finding links can take time, but it makes your posts more valuable to readers. For example, in the previous tip, I linked to the plugin page so you could easily find it. Otherwise, you would have probably had to search for it, and there would be no guarantee that you’d find the plugin I was talking about. Zemanta totally takes the hassle out of linking. This plugin gives you a list of potential in-text links you can add, which updates as you type. In addition, it gives you a list of related articles based on your post, which you can update as you type. You just link on their recommendations to add links as you see fit. Super easy! You can even choose to create a profile and tell Zemanta the blogs you like most so it will draw links from those sites when possible.

5. Prevent Images from Being Too Wide

If you’re working with images, it can sometimes be annoying to remember the max width they can be to fit on your blog. I have a lot of trouble with this one since I blog on multiple sites, all using different themes. If your image is too wide, it will either cut off or overlap onto your sidebar, depending on the them you’re using. Both look pretty bad.

It’s an easy fix. I learned this one from WPHacks. You have to go into the code, but don’t be scared! It’s easy; I promise! Under “appearance” on the left-hand dashboard sidebar, you want to click on editor and find your theme’s .css file (probably the one that comes up by default. Then, just follow the instructions here to add a snippet of code. That’s it! If you can handle copy/pasting, you can do this one. Once you change the max to fit whatever your theme’s max width is, you won’t have to deal with cut off or overlapping pictures ever again.

6. Install the Editorial Calendar Plugin

Recently, we added this plugin here on the BlogWorld blog and it has been a total game-changer for me! I like to stay organized and am a very visual person. The editorial calendar plugin gives me a way to see when posts are being updated, and for a multi-author blog, it allows you to understand when others are planning to publish so you can strategically plan out your content schedule. I also like that you can jot down ideas quickly using the calendar when you have a post idea, and the visual nature makes it easy to see where you’re faltering: Are you uploading too many posts about a specific topic? Are you updating enough? Is your content always bunched instead of spread out? You can also use the calendar to schedule your content easily. Love it.

7. Split Long Posts

Depending on your theme, long posts may or may not look good on your homepage. You can use the “more” tag to split the post after a few teaser paragraphs. It’s the little split button beside the link buttons on your tool bar (see picture) or you can just hit Alt+Shift+T.

By default, this will create a link that says “Continue Reading” or “Read More” or something of that sort, depending on the theme you use. Want to change the text? It’s pretty easy. It requires you to go into your code again, but don’t be scared! Under Appearance on your sidebar, click on editor and then find the index.php file (Main Index Template). Search for:

<?php the_content(‘Read more …’); ?>

If your blog by default has different text, the theme editors already changed it, so that’s what you should search for. In other words, if when you split the text and publish the post, it says on your site, “Click here for more…” you should search for:

<?php the_content(‘Click here for more…’); ?>

Search for whatever that text might be. Then, once you find that line in the code, you can change the text to read whatever you want.

It’s a great way to get more page views out of a single long post.

So there you have it, seven of my favorite WordPress hacks for bloggers. Now it’s your turn to tell us your favorite hacks and tips with a comment below!

How to hide files inside a picture ?


On this article i am going to tell how to hide files inside a picture that is Steganography.What is Steganography?

Steganography:-The art of hiding a file or folder inside a completely different file.More specifically hiding files inside a picture.
Now let me tell you what are the things you need to hide a file or folder inside picture.Noting just a computer,a file or folder and a picture.

Step(i):-Start>Run>cmd
Step(ii):-Place the file to be hidden and the picture you want to hide in it,inside the same folder.

Step(iii):-Start up the command terminal.
Step(iv) :-Change the directory of the terminal to the folder you have placed the files in using the “cd” command.

tep(v):-Type copy /b +
And press enter.
There will be a new picture inside the folder with name you have specified.
As you can see the file localization is hidden in picture techyhuman.jpg to form a new image techyhumanhack.
Now the real problem is how to access the hidden file?Let me tell that too.

To access the hidden file,change the extension of the picture to the extension of the hidden file.That’s it icon smile How to hide files inside a picture ? Happy hiding icon biggrin How to hide files inside a picture ?