BSNL Night-time, connect automatically using scheduler

If you have the BSNL or any other PPPoE connection that gives you free time, like from 2 AM to 8 AM as in BSNL and you want to schedule your heavy downloads for that time, read this post.

The key idea here is to schedule using Windows Task Scheduler or Scheduled Tasks according to the version of windows you are using.

First thing to do, create a dial-up connection named BSNL in "network connections", chances are that you already have one.  If you're using auto-connection where you get net if you just turn on the modem, you should configure your modem/router to connect via PAP. To do this, type in http://192.168.1.1 in the address bar of your favorite browser (this is in a default setup, if your router is located at a different IP, enter that). You will need to enter an username and password, this is generally "admin" "admin" but can vary with the kind of router you are using. This should take you to the configuration page of your router, where you will set WAN to use PAP instead of AUTO in PPPoE.

Next thing, create a batch file in System32 (I say, System32, you could do this anywhere you want) to do this, goto Start -> Run -> type in "cmd" without quotes and hit enter

Once you have your command prompt, navigate to System32, under a default windows installation, this is what you have to do type in "CD C:\WINDOWS\SYSTEM32\" Once you are in system32, do the following

COPY CON CONNECT.BAT
@ECHO OFF
RASDIAL BSNL USERNAME PASSWORD //Replace with your username and password
^Z  //CTRL+Z

You should type in the last line using CTRL+Z together don't literally type in ^Z. Now you made the connect.bat. Running this file should get you connected to the internet, you can test it by running connect.bat from command prompt.

Now open windows task scheduler and configure to run Connect.bat at 2:02 AM everyday.
Now using task-scheduler, you should also setup termination of connection and shutdown of machine at 8:00. You can do this either way, either you can simply disconnect the connection or shutdown the machine.

To disconnect the machine, setup a program to run at 7:58 every day. You could either run RASDIAL /DISCONNECT or to shutdown the machine, you can run SHUTDOWN.EXE /S /F /T 59

Hope that helped, if you still have any doubts, post it in the comments.

integrating facebook share or like with open graphics og tags on wordpress

There are a million different ways of adding a facebook share or like button to your wordpress site, there are plugins, there are tutorials, but those never works right.

What is the proper way of adding Facebook like button ?

More often that not, when you add the Facebook like button to your Wordpress website, the like button picks up the wrong content, the wrong image, and the wrong description and wrong link if you set it to work automatically, if you're a Wordpress developer who frequently uses premium themes like I do, there may be thumbnail images attached with the posts (sometimes you want the like button to display the first post in the page, in the home page, may be you want to display your logo) 

And if you've done enough research, you'd know that you should use the Open Graph Protocol og:tags, but og:tags works only in the header, may be the image you want to put up could be the generated within the loop, so how do you put an image that's in the loop ? Its simple, you create mulitple loops. Create a loop in the header (between the  tags) that will generate content for the meta data and then generate another one for your posts. Here's how I did it, if you're too lazy, you could copy my code.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/" <?php language_attributes(); ?>>
<?php if (have_posts()):while(have_posts()):the_post();endwhile;endif;?>
<!-- Facebook Opengraph -->
<meta property="fb:app_id" content="your_app_id" />
<meta property="fb:admins" content="your_admin_id" />
<meta property="og:url" content="<?php the_permalink() ?>"/>
<?php if (is_single()) { ?>
<meta property="og:title" content="<?php single_post_title(''); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php echo wp_get_attachment_thumb_url( get_post_thumbnail_id( $post->ID ) ) ?>" />
<?php } else { ?>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php bloginfo('description'); ?>" />
<meta property="og:type" content="website" />
<meta property="og:image" content="<?php bloginfo('template_url') ?>/path/to-your/logo.jpg" />
<?php } ?>

dear me

Dear damned and loose low waist jeans,

The best time to remind me that i'm not wearing a belt is NOT when i'm trying to cross the national highway in heavy traffic.

Sincerely,
The underwear that got all the attention today.