Tuesday, February 14, 2012

Embed Offline Prezi to PowerPoint Presentation

There are a lot of people asking how to embed Prezi to PowerPoint presentation.
Someone give a solution such as insert a swf prezi file downloaded to PowerPoint.
This works fine for the newly inserted swf prezi.

Unfortunately, when you save your work, close your PowerPoint, and then re-open it,you will find that your swf prezi page will be locked and not able to run any more.

The following is my solution:
1) create two VBA macros in PowerPoint: one of them named addPreziSwf and the other named deletePreziSwf.

Contents of addPreziSwf are as follows:
Sub addPreziswf()
Dim s As Shape
Set s = ActivePresentation.Slides(1).Shapes.AddOLEObject(120, 120, 320, 320, ClassName:="ShockwaveFlash.ShockwaveFlash")
With s.OLEFormat.Object
.Left = 30
.Top = 40
.Height = 500
.Width = 660
.Movie = "prezi.swf"
End With
With SlideShowWindows(1).View
.GotoSlide 2
.GotoSlide 1, msoFalse
End With
End Sub



Contents of deletePreziSwf are as follows:
Sub deletePreziswf()
Dim myDocument As Slide
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes("ShockwaveFlash1").Delete
End Sub

2) Draw two shapes as buttons and attach actions to the two buttons. One of the button attach the addPreziswf macro. Another button attach the deletePreziswf macro.

3) Save the PowerPoint as PowerPoint macro enabled presentation (*.pptm)

You can now close the PowerPoint document and exit PowerPoint.
When you re-open the PowerPoint document,
a) click slideshow: activate slideshow mode
b) click the addPreziSwf button: run the Prezi swf movie
c) If you want to delete the Prezi swf movie during the slideshow, just click the deletePreziSwf button.

This solution works perfectly. Enjoy!!

Wednesday, May 23, 2007

Example for php sending email

<?
$to = "johndate@computer.com";
$subject = "Hello!";
$body = "John,\n\nHow are you doing?";

if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>


A simple email using MIME protocol:

From: "David Willson"
To: "John Date"
Subject: Just Say Hi!
Date: Fri, 28 Feb 2003 18:12:32 -0400
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit;

Hi David! How are you doing?

What is MIME?

MIME is a protocol.
MIME stands for multipurpose internet mail extensions.

How to send email via PHP

Sorry! PHP cannot send email itself.
To send email, PHP must use the MIME protocol.

Friday, May 12, 2006

Adding Background Sound in Flash

1) Select {File - Import - Import to Stage} (see figure 1)


2) Select a sound file.

3) Use your mouse to select a Layer (Note: you can rename the layer "sound" ).

4) In Properties, choose the sound. (see figure 2)

Thursday, May 11, 2006

check for integer input in C++

The following source code could check whether your input is an integer:

#include <iostream>
#include <string>
#include <ctype.h>
#include <stdlib.h>
using namespace std;
int main () {
     int n, ans;
     string instr;
     cout << "Enter an integer: ";
     cin >> instr;
     cout << instr.c_str() << endl;
     const char *c_instr = instr.c_str();
     for( int i=0; i<instr.length(); i++) { // check input
          if( !isnumber( c_instr ) ) {
               cout << "Input error: MUST be a positive integer.\n";
               exit(1);
          }
     }
     n = atoi( c_instr ); // convert to number
     ans = n + 1;
     cout << ans;
     return 0;
}