To clear the mysql-bin.0000 log files

My configuration:
– Windows OS
– Wampp Installation

Steps:

1. Goto wamp\bin\mysql\mysql5.5.16\my.ini file

2. Add “expire_logs_days = X” to the my.ini file
Where X is the number of days to keep the logs.
Eg:
expire_logs_days = 10  // then we will have only last 10 days log

Advertisements
Categories: Mysql

Include new style fonts in Client Server/ Projects

http://www.fontsquirrel.com/fontface/generator

If we want to include any new style folnt in Server we can run the file and get the script and include in our CSS file in two ways,

First Way

@font-face {
font-family: ‘GothamBlackRegular’;
src: url(‘font/gotham-black-webfont.eot’);
src: url(‘font/gotham-black-webfont.eot?#iefix’)
format(’embedded-opentype’), url(‘font/gotham-black-webfont.woff’)
format(‘woff’), url(‘font/gotham-black-webfont.ttf’)
format(‘truetype’),
url(‘font/gotham-black-webfont.svg#GothamBlackRegular’)
format(‘svg’);
font-weight: normal;
font-style: normal;
}

Second Way

1. Copy the “Calibri” font from System font folder and place in our Project CSS folder.

2. Include in the CSS file as below, (This is for Iphones& Tablet. This option will not work in IE. So we need to prefer the First Way)

@font-face {
font-family: ‘Calibri’;
src: url(‘fonts/calibri.ttf’);
font-weight: normal;
font-style: normal;
}

Categories: CSS

HTML Webpage to Image – OS Independent

STEPS:

  1. Place the below code in a PHP/HTML file, we will get the thumb image of the given Website
<img src=”http://pagepeeker.com/thumbs.php?size=m&url=http://www.xxxxxx.com/sales-updates&#8221; border=”0″>
  1. The values for size can be: t / s / m / l / x
Categories: PHP

HTML Webpage to Image On Windows – OS Dependent

Note:

  • It works only with Windows OS –  OS Dependent

Steps:

  1. Download and install webthumb-activex-setup.exe from http://www.acasystems.com/en/web-thumb-activex/download.htm
  2. Then paste the below code and save as imageGrap.php

<?php

// Set the save folder

  // [IMPORTANT NOTE]:

  // This sample saves the snapshot to the folder on the work dir of this script.

  // Please make sure the script has the WRITE permission in this folder.

  // You can also set the value to other folder, for example:

  //   $t_strSaveFolder = “c:/temp”;

  $t_strSaveFolder = dirname(__FILE__);

  // Set the image filename

  $t_strLargeImage = $t_strSaveFolder.”/main-thumb.large.png”;

  $t_strSmallImage = $t_strSaveFolder.”/main-thumb.small.png”;

  // Create instance ACAWebThumb.ThumbMaker.

  $t_xMaker = new COM(“ACAWebThumb.ThumbMaker”)

    or die(“Start ACAWebThumb.Maker failed”);

  // Set the URL and start snap

  $t_strURL = ‘http://www.sitename-xxxxx.com/&#8217;; // Site URL

  $t_xMaker->SetURL($t_strURL);

  $t_iRet = $t_xMaker->StartSnap();

  if ( 0 == $t_iRet )

  {

    // snap successful, save webpage to image with full size.

    $t_bRet1 = $t_xMaker->SaveImage($t_strLargeImage);

    // save webpage to thumbnail with 320×240 size

    $t_xMaker->SetThumbSize (320, 240, 0);

    $t_bRet2 = $t_xMaker->SaveImage($t_strSmallImage);

    // show the image online.

    if ( $t_bRet1 && $t_bRet2)

    {

      echo “The snapshot from <a href='”.$t_strURL.”‘ target=_blank>”.$t_strURL.”</a>:”;

      echo “<a href=’main-thumb.large.png’>img src=’main-thumb.small.png’ border=1></a>”;

    }

    else

    {

      echo “ERROR: Can’t save the snapshot to folder “.dirname(__FILE__).”. “;

      echo “Please make sure the script has the WRITE PERMISSION in this folder.”;

    }

  }

  else

    echo “ERROR: Snap from “.$t_strURL.” failed. “;

?>

3. Run the file, we will get the Webpage as image on the same folder.

Categories: PHP

Twitter Sign-in & Tweet with Drupal 7.10

  1. Download the module from http://drupal.org/project/twitter
  2. We also need Oauth module, so get it from http://drupal.org/project/oauth
  3. Unpack the modules and place it in the sites/all/modules folder
  4. Enable OAuth & Twitter in the admin/modules

5. Goto Twitter configuration page, http://10.21.1.14/drupal-7.10/admin/config/services/twitter

6. Click register your application link, will take us to the https://dev.twitter.com/apps/new page. We need to add our website URL link to Twitter applications. Note: Developer site link – https://dev.twitter.com/apps/
7. Login with twitter account credentials, mouse over on the name(Right-Top Corner). Click “My Applications”. Click “Create a new application” and we will get the below form,

8. Fill the form:

Name –The name which the user decides

Description – About website

Website – Provide the website URL/ we can give our development server IP based URL

Application Type (Mandatory) – Select  Read and Write

Callback URL (Mandatory) – The URL given in Website & add /twitter/oauth as suffix

Save and Update the configuration details.

9. We will get now the OAuth token values,

10. Enter the Consumer Key in OAuth Consumer key & Consumer Secret in OAuth Consumer secret in http://10.21.1.14/drupal-7.10/admin/config/services/twitter and click Save Configuration
11. 
If each and every Article/ Page has to be posted into Twitter Select the Node Types in the POST tab.
12.
If required default format of submitting the text into Twitter can be changed

13.
Change the basic settings of Twitter SIGN-IN if required.

14. Then Save Configuration.

15. Select the Content type selected in Step:12

16. Add the content and we have an option to post it to Twitter. Select the checkbox.

17. Click Save. Now the content is tweeted in Twitter.

Categories: Drupal

How to bring Administration Menu on the top of the page in Drupal

1. Enable Toolbar in admin/modules and click Save Configuration

Categories: Drupal

Include Windows Media Player in HTML – Firefox

1. Download wmpfirefoxplugin.exe from online.
you can download it from http://www.mediafire.com/?idnw2nkt2em also.

2. Save and run the file.

3. Detect the browser accordingly and we can add the <object> tag.

<SCRIPT type=”text/javascript”>if(-1 != navigator.userAgent.indexOf(“MSIE”))   // internet explorer version

{

document.write(‘<OBJECT id=”Player”‘);

document.write(‘ classid=”clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6″‘);

document.write(‘ width=400 height=300> <param name=”playCount” value=”1″> <PARAM name=”URL” value=”helicopter.mpg”></OBJECT>’);

}

else if(-1 != navigator.userAgent.indexOf(“Firefox”))  // firefox version

{

document.write(‘<OBJECT id=”Player”‘);

document.write(‘ type=”application/x-ms-wmp”‘);

document.write(‘ width=400 height=300> <param name=”playCount” value=”1″> <PARAM name=”URL” value=”helicopter.mpg”></OBJECT>’);

}

</SCRIPT>

4. Instead of adding thru Javascript we can add in Html also as,

<object id=”Player” type=”application/x-ms-wmp” height=”590px” width=”1045px” style=”padding-top:13px;”><param value=”videos/AL_JANBUS.mp4″ name=”url”>

<param name=”playCount” value=”1″>

<param name=”uiMode” value=”none”>

<!–If we need controls enable this–>

<!–<param name=”uiMode” value=”full”>–>

</object>

5. The entire code is given below,

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <TITLE>video tracking of windows embedded mediaplayer play pause events</TITLE>

<script type="text/javascript">

function submit_action(action) 
{
         YWATracker = YWA.getTracker(project_PID);
         YWATracker.setAction('' + action);
         YWATracker.submit_action();
}

</script>
</head>

<body>

<SCRIPT type="text/javascript">
      if(-1 != navigator.userAgent.indexOf("MSIE"))
      {
        document.write('<OBJECT id="Player"');
        document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
        document.write(' width=400 height=300> <param name="playCount" value="1"> <PARAM name="URL" value="helicopter.mpg"></OBJECT>');
      }
      else if(-1 != navigator.userAgent.indexOf("Firefox"))
      {

        document.write('<OBJECT id="Player"');
        document.write(' type="application/x-ms-wmp"');
        document.write(' width=400 height=300> <param name="playCount" value="1"> <PARAM name="URL" value="helicopter.mpg"></OBJECT>');
      }    
</SCRIPT>
<BR>

<!--example holders for player status information -->
<P id="p1">...</P>
<P id="p2">...</P>
<P id="p3">...</P>

<script type="text/javascript" src="http://d.yimg.com/mi/ywa.js"></script>
<script type="text/javascript">

video_duration = Player.currentMedia.duration;
p3.innerHTML = video_duration;

/*globals YWA, YWATracker */
//set project PID of target project - avaialble from installation section of UI
project_PID="1000123456789";

YWATracker = YWA.getTracker(project_PID);
YWATracker.setDocumentName('Video_page');
YWATracker.setDocumentGroup('Video_group');
YWATracker.submit();

</script>
<noscript>
<div><img src="http://stats.indextools.com/p.pl?a=1000xyz1332777957&js=no" width="1" height="1" alt="" /></div>
</noscript>
<!-- End of IndexTools  Code  -->

<script type="text/javascript">
function OnDSPlayStateChangeEvt(NewState){

// this section deals with video play stop pause etc events 

    p1.innerHTML = "Play state: " + NewState;
         video_duration = Player.currentMedia.duration;
         p3.innerHTML = video_duration;

         switch (NewState){
                 case 1: // Stopped
                          submit_action(6);
                 break;

                 case 2: // Paused
                          video_paused_position=0;
                          video_paused_position=Player.controls.currentPosition;
                          video_paused_position = parseInt(video_paused_position);  // just have whole seconds = so convert to int
                          //otionall add code to send paused position as a Custom Field
                          submit_action(7);
                 break;

                 case 3: // Playing
                          submit_action(8);
                          break;
                 case 4: // FastScanForward
                          submit_action(9);
                          break;
                 case 5: // FastScanRewind
                          submit_action(10);
                          break;
                 case 6: // Buffering
                          submit_action(11);
                          break;
                 case 7: // Waiting
                          submit_action(12);
                          break;
                 case 8: // Media Ended
                          submit_action(35);
                          break;
                 case 9: // Transitioning
                          submit_action(13)
                          break;
                 case 10: // Ready
                          submit_action(14);
                          break;
         }
}
</script>

<script type="text/javascript">
function OnDSPositionChangeEvt(video_old_position, video_new_position){
// this section deals with video position slider bar change events
         video_duration = Player.currentMedia.duration;
         p3.innerHTML = video_duration;
         text_pos = 'Position_Change_Event_';
         video_old_position = parseInt(video_old_position);  // deleted fractions of a second - convert to int
         video_new_position = parseInt(video_new_position);  // deleted fractions of a second - convert to int
         text_pos = text_pos + video_new_position +'_' + video_old_position;
         submit_action(15);
         p2.innerHTML = "PLAYING_POSITION_CHANGED "+ text_pos;

         if(video_new_position>video_old_position){
// do some code to say skipped forward, e.g. store from and to position in action based Custom Fields
         }

         if(video_new_position<video_old_position){
// do some code to say skipped backwards, e.g. send positive user action signal, e.g. store from and to position in action based Custom Fields
         }
}
</script>

</body>
</html>

5. To continously run without manual interaction,

function OnDSPlayStateChangeEvt(NewState){

         switch (NewState){
                 case 1: // Stopped
                          submit_action(6);

.

..

..

}

Change to

function OnDSPlayStateChangeEvt(NewState){

.

.

.

case 1: // Stopped

            Player.controls.play();

.

.

}

6.  Now save the file and run.

Additional notes: If we want to remove the controls add

<param name=”uiMode” value=”none”>

which will remove all controls and look like flash players.

Categories: HTML Snippets