PPT Macro for Formatting multiple slides


Dear All,

Many times we come across situation in which we need to format 100's of slides withing specified amount of time, and doing it manually is really not a smart way thats where macro comes in picture.

Below is sample macro I have written for formatting active slides :

I hope you know how to run macros ;) else you can always take help from Google!!!!!!


Dim myvar As Slide
Dim myvar1 As Shape


For Each myvar In ActivePresentation.Slides
For Each myvar1 In myvar.Shapes


With myvar1
.Left = 50
.Top = 71
.LockAspectRatio = msoFalse
.Height = 410
.Width = 624
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(255, 0, 0)
.Line.Weight = 0.5

 
End With

Next
Next


Above macro will simple change formatting for all active slides ;)

Hope you enjoyed!!

Best Regards,
Girish

Dynamic Column width in BI Publisher

Dynamic Column width in BI Publisher

This has been a complex task to assign width of column dynamically in BI Publisher. This means number of columns is not fixed and they will come dynamically from XML and we want width of the columns to be distributed equally or in some ratio. Combined width of all columns assigned dynamically will be taken up from the width that we assign to that particular column. If there is only single column coming from XML then it will take up all width. If there are multiple columns then the width will be equally distributed or we can define in which ratio it should be distributed.

How it is done ?

Here is an example of how it can be done in BI Publisher.

1. Load Below XML:


< ?xml version="1.0" encoding="utf-8"?>
< TestScoreTable>
< LIST_COLUMNS>
< LIST_COLUMN>
< LIST_COLUMN_HEADING>Current Terms< /LIST_COLUMN_HEADING>
< /LIST_COLUMN>
< LIST_COLUMN>
< LIST_COLUMN_HEADING>2 - 30 Days< /LIST_COLUMN_HEADING>
< /LIST_COLUMN>
< LIST_COLUMN>
< LIST_COLUMN_HEADING>31 - 60 Days< /LIST_COLUMN_HEADING>
< /LIST_COLUMN>
< LIST_COLUMN>
< LIST_COLUMN_HEADING>61 - 90 Days< /LIST_COLUMN_HEADING>
< /LIST_COLUMN>
< LIST_COLUMN>
< LIST_COLUMN_HEADING>91 - Plus Days< /LIST_COLUMN_HEADING>
< /LIST_COLUMN>
< /LIST_COLUMNS>
< TestScores>
< TestCategory>Mathematics< /TestCategory>
< TestScore width ="15">
< TestScoreRange>0-20< /TestScoreRange>
< NumofStudents>30< /NumofStudents>
< /TestScore>
< TestScore width ="10">
< TestScoreRange>21-40< /TestScoreRange>
< NumofStudents>45< /NumofStudents>
< /TestScore>
< TestScore width ="15">
< TestScoreRange>41-60< /TestScoreRange>
< NumofStudents>50< /NumofStudents>
< /TestScore>
< TestScore width ="10">
< TestScoreRange>61-80< /TestScoreRange>
< NumofStudents>102< /NumofStudents>
< /TestScore>
< TestScore width ="15">
< TestScoreRange>81-100< /TestScoreRange>
< NumofStudents>22< /NumofStudents>
< /TestScore>
< /TestScores>
< /TestScoreTable>

2. create below template in BIP.

template in BIP

3. Modify code in template according to below table as shown in image below:

    Text To Display        Code    
  Group:TestScore    < ?for-each:TestScores?>  
  < ?TestCategory?>    < ?TestCategory?>  
  Column Header and Splitting    < ?split-column-header:TestScore?>< ?split-column-width:@width?>< ?TestScoreRange?>  
  Content and Splitting    < ?split-column-data:TestScore?> < ?NumofStudents?>  
  End:TestScore    < ?end for-each?>  


BI Publisher

4. Hit Pdf under BI Publisher and your pdf will be like shown below:


BI Publisher
Here you can see that we have defined width of each column in XML like .
If we remove one or two columns and see output then we will see that width of these columns has been distributed in others.

BI Publisher

Sending mail with attachment in JAVA

Sending mail with attachment in JAVA

The JavaMail API is a set of abstract APIs that model a mail system. The API provides a platform independent and protocol independent framework to build Java technology based email client applications. The JavaMail API provides facilities for reading and sending email. The package defines classes that are specific to mail systems based on internet standards such as MIME, SMTP, POP3, and IMAP.
Jar files required:

1. mail.jar that you can download here

Java Source code Sending Mail


package mail;

import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.PasswordAuthentication;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;


public class sendMail {


static String username = "abcdefgh"; //replace this with a valid username
static String password = "password"; //replace this with a valid password

public static void main(String[] args)throws Exception{

try{


String host = "mail.xyz.com"; //replace this with a valid host
int smtpPort = 000; //replace this with a valid port
String from = "testmail@mail.com"; //replace this with a valid email id
String to = "findmail@mail.com"; //replace this with a valid email id
String fileAttachment1 = "D://file1.txt"; // file to attach
String fileAttachment2 = "D://file2.pdf"; // file to attach

Properties props = System.getProperties();
props.put("mail.smtp.host", host); // Setup mail server
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", smtpPort);
Session session = Session.getDefaultInstance(props); // Get session
MimeMessage message = new MimeMessage(session); // Define message
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject("Find Attachment"); // create the subject
MimeBodyPart messageBodyPart = new MimeBodyPart(); //fill message
messageBodyPart.setText("Welcome to JAVA Family"); // create the message part
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart); // Part two is attachment

messageBodyPart = new MimeBodyPart();
DataSource source1 = new FileDataSource(fileAttachment1);
messageBodyPart.setDataHandler(new DataHandler(source1));
messageBodyPart.setFileName(fileAttachment1.substring(4, fileAttachment1.length()));
multipart.addBodyPart(messageBodyPart);

messageBodyPart = new MimeBodyPart();
DataSource source2 = new FileDataSource(fileAttachment2);
messageBodyPart.setDataHandler(new DataHandler(source2));
messageBodyPart.setFileName(fileAttachment2.substring(4, fileAttachment2.length()));
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}
}

How to take ScreenShot in iOS ?

How to take ScreenShot in iOS ?

Sometimes requirement arises in iPhone/iPad app that how we get screenshot of a particular UI part. So this captured screenshot can be sent as attachment to authorities via mail or can be written on to photo library.

MyImage Subclass of UIImage

We have to make subclass of UIImage that is MyImage and we are going to implement some extra methods inside it to get screen shot of a particular UI part. so customized MyImage Class code is given below.

MyImage.h File


@interface UIImage (MyImage)
+ (UIImage*)imageFromView:(UIView*)view;
+ (UIImage*)imageFromView:(UIView*)view scaledToSize:(CGSize)newSize;
+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize;
@end

MyImage.m File


#import < QuartzCore/QuartzCore.h>
#import "MyImage.h"
@implementation UIImage (MyImage)
+ (void)beginImageContextWithSize:(CGSize)size
{
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
if ([[UIScreen mainScreen] scale] == 2.0) {
UIGraphicsBeginImageContextWithOptions(size, YES, 2.0);
} else {
UIGraphicsBeginImageContext(size);
}
} else {
UIGraphicsBeginImageContext(size);
}
}

+ (void)endImageContext
{
UIGraphicsEndImageContext();
}

+ (UIImage*)imageFromView:(UIView*)view
{
[self beginImageContextWithSize:[view bounds].size];
BOOL hidden = [view isHidden];
[view setHidden:NO];
[[view layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
[self endImageContext];
[view setHidden:hidden];
return image;
}

+ (UIImage*)imageFromView:(UIView*)view scaledToSize:(CGSize)newSize
{
UIImage *image = [self imageFromView:view];
if ([view bounds].size.width != newSize.width ||
[view bounds].size.height != newSize.height) {
image = [self imageWithImage:image scaledToSize:newSize];
}
return image;
}

+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize
{
[self beginImageContextWithSize:newSize];
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
[self endImageContext];
return newImage;
}
@end

TakeScreenShot Method

This is method, put inside your class where-ever you need to take screenshot Here
1) filePath is Document Directory path where your screenshot will be stored finally.
2) customizedView is your View , whose screenshot you want to capture.


-(void)takeScreenShot{
NSArray *arrPaths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *strDocumentPath = [arrPaths objectAtIndex:0];
NSString *filePath = [strDocumentPath stringByAppendingPathComponent:@"screenshot.png"];

UIImage *img = [UIImage imageFromView:customizedView];
//imgSignature.image = img;
NSData *imgData = UIImageJPEGRepresentation(img, 0.0);
[imgData writeToFile:filePath atomically:YES];
}

screen shot method

Send Email on Startup and Shutdown Process on Linux Server

Send Email on Startup and Shutdown Process on Linux Server

It is always nice to have notification when a server reboots, especially when you are on vacation, away from the office, or just hanging around! In order to send an email on reboot, we can easily create a cron job to run on reboot. This means for a single reboot the Administrator will receive two emails. This solution will not send out an email if the system loses power, however an email will still be sent on reboot. This should indicate to the Administrator that something went wrong with the shutdown. The tips below are for a RedHat based system but should be similar in other architectures.
First thing we need is to create a new script "NotifyEmail"
Paste the following code into that document .


#!/bin/sh
EMAIL="example@example.com"
RESTARTSUBJECT="["`hostname`"] - System Startup"
SHUTDOWNSUBJECT="["`hostname`"] - System Shutdown"
RESTARTBODY="This is an automated message to notify you that "`hostname`" started successfully.
Start up Date and Time: "`date`
SHUTDOWNBODY="This is an automated message to notify you that "`hostname`" is shutting down.
Shutdown Date and Time: "`date`
LOCKFILE=/var/lock/subsys/NotifyEmail
RETVAL=0

# Source function library.
. /etc/init.d/functions

stop()
{
echo -n $"Sending Shutdown Email: "
echo "${SHUTDOWNBODY}" | mutt -s "${SHUTDOWNSUBJECT}" ${EMAIL}
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
rm -f ${LOCKFILE}
success
else
failure
fi
echo
return ${RETVAL}
}
start()
{
echo -n $"Sending Startup Email: "
echo "${RESTARTBODY}" | mutt -s "${RESTARTSUBJECT}" ${EMAIL}
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
touch ${LOCKFILE}
success
else
failure
fi
echo
return ${RETVAL}
}
case $1 in
stop)
stop
;;
start)
start
;;
*)
esac
exit ${RETVAL}

Save the document by CTRL+O (To Write) and then press CTRL+X (To exit the Editor)
First, we need to make it executable:


chmod u+x NotifyEmail

Now we want to set this up to run at start up and shut down. Copy the script from your home directory to the init.d directory.


cp NotifyEmail /etc/init.d/

Last thing we do is set this up to run automatically by configuring it via chkconfig.


chkconfig --levels 3 NotifyEmail on

The code goes into a file under /etc/init.d
Then you go into /etc/rc.d folder and edit rc.local file. There you add:
Code:


/etc/init.d/NotifyEmail start

Also make a file called rc.local_shutdown in /etc/rc.d/ folder. In that file you add:
Code:


/etc/init.d/NotifyEmail stop

Now using these steps you will receive two mails during startup and shutdown process

Alternative Simple Way for Email Alert on Reboot:

Edit your crontab:


crontab –e

Add the following:


@reboot echo "Server has restarted "`hostname` | mail -s "System Restart" your@email.address

Now using these simple steps you will receive mail whileserver reboot.

Control File in DBMS

Control File in DBMS

The Control File of the database is a binary file that contains database information such as the database name, data about the database log files and data files, timestamp of database creation, tablespace name, checkpoint information and backup information. Database can't open without a Control file.
Getting information of current control file in use:


SQL>SHOW PARAMETER control_files;
SQL>SELECT * FROM v$controlfile;
SQL>SELECT * FROM v$controlfile_record_section;

MULTIPLEXING THE CONTROL FILE USING SPFILE

Let we had two control file control01 and control02 in our database. We are going to multiplex control03 in our database.


SQL>ALTER SYSTEM SET CONTROL_FILES='$HOME/ORADATA/U01/control01.ctl'
'$HOME/ORADATA/U01/control02.ctl','$HOME/ORADATA/U01/control03.ctl' SCOPE=spfile;
SQL>shutdown immediate;

Copy the existing control file with new name control03.ctl on defined path of spfile parameter so that it is available on the os level.

$cp $HOME/ORADATA/U01/control01.ctl $HOME/ORADATA/U01/control03.ctl

Control files can be multiplexed up to eight times. The Oracle server maintains all files listed in spfile parameter when instance is started.

SQL>startup

MULTIPLEXING THE CONTROL FILE USING PFILE

SQL>create pfile from spfile;
SQL>shutdown immediate;

Copy the existing control file with new name control03.ctl

$cp $HOME/ORADATA/U01/control01.ctl $HOME/ORADATA/U01/control03.ctl

Open the pfile and add a new control file control03.ctl and its path in CONTROL_FILES parameter.

SQL>startup;

CONTROL FILE BACKUP

Because the control file records the physical structure of the database so it's an important part of oracle database. It's important to make a backup of control file.

SQL>ALTER DATABASE BACKUP CONTROLFILE TO '/tmp/control_file.bkp';

We can also make backup of control file to a trace file. This trace can contains a script to recreate a control file. Trace file created in UDUMP directory.


SQL>ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/tmp/create_control_file.sql'

Moving ORADATADirectory to another location in Oracle DataBase

Moving ORADATADirectory to another location in Oracle DataBase

Database files are stored in ORACLE_BASE\oradata\DB_NAME\ If you want to move the oradata directory to another location or directory then the minimum required steps are as follow

Step 1:


Creation of tracecopy of the Control file

SQL>ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

The Default location of tracecopy is USER DUMP destination. If you want to find the USER DUMP Destination then use
the following statement

SQL> SHOW PARAMETER USER_DUMP_DEST;

Step 2:

SQL>CREATE PFILE FROM SPFILE;

Step 3:

SQL>SHUTDOWN IMMEDIATE;

Step 4:

Move the ORADATA directory to another location or to the new drive.

Step 5:

SQL>SHUTDOWN IMMEDIATE;

Step 6:

Find the pfile (Default name is initSID.ora).Open the pfile and change the value of CONTROL_FILE parameter to the new location of oradata directory.

Step 7:

SQL>CREATE SPFILE FROM PFILE;

Step 8:

SQL>sqlplus / as sysdba SQL>stratupnomount;

Step 9:

Edit the trace copy of control file created in Step 1 and change the location of data files and Redo log files. Use this script in mount state to create new control file


CREATE CONTROLFILE REUSE DATABASE "SID_NAME" RESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u02/oradata/SID_NAME/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u02/oradata/SID_NAME/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u02/oradata/SID_NAME/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u02/oradata/SID_NAME/system01.dbf',
'/u02/oradata/SID_NAME/sysaux01.dbf',
'/u02/oradata/SID_NAME/undotbs01.dbf',
'/u02/oradata/SID_NAME/users01.dbf',
'/u02/oradata/SID_NAME/example01.dbf',
CHARACTER SET WE8MSWIN1252
;

Step 10:

Open the Database
SQL>ALTER DATABASE OPEN;

Virtualization

virtualization:

In computing, virtualization means to create a virtual version of a device or resource, such as a server, storage device, network or even an operating system where the framework divides the resource into one or more execution environments. Even something as simple as partitioning a hard drive is considered virtualization because you take one drive and partition it to create two separate hard drives. Devices, applications and human users are able to interact with the virtual resource as if it were a real single logical resource. The term virtualization has become somewhat of a buzzword, and as a result the term is now associated with a number of computing technologies including the following:


• Storage virtualization: The amalgamation of multiple network storage devices into what appears to be a single storage unit.
• Server virtualization: The partitioning a physical server into smaller virtual servers.
• Operating system-level virtualization: A type of server virtualization technology which works at the operating system
(kernel)layer.
• Network virtualization: Using network resources through a logical segmentation of a single physical network.
• Application virtualization: Also called application service virtualization. Application virtualization is layered on
top of other virtualization technologies, such as storage virtualization or machine virtualization to allow computing
resources to be distributed dynamically in real time.
• Virtualization Software : VMware, Oracle Virtual Box Etc.

ORACLE VIRTUAL Box:

Virtual Box is a cross-platform virtualization application. What does that mean? For one thing, it installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. Secondly, it extends the capabilities of your existing computer so that it can run multiple operating systems (inside multiple virtual machines) at the same time. So, for example, you can run Windows and Linux on your Mac, run Windows Server 2008 on your Linux server, run Linux on your Windows PC, and so on, all alongside your existing applications. You can install and run as many virtual machines as you like -- the only practical limits are disk space and memory. VirtualBox is deceptively simple yet also very powerful. It can run everywhere from small embedded systems or desktop class machines all the way up to datacenter deployments and even Cloud environments.

How To Convert PSD To HTML And CSS For Your Websites

Most designers have the ability to create a professional websites in software’s like Photoshop, but are not able to convert a PSD files to a W3C valid HTML and CSS code that could be optimized for search engines. In order to learn these you can follow PSD to HTML tutorials that are found easily on the internet. By following these you can bring the theory directly into practice. But it seems to be difficult to understand for the beginners. This roadmap will help the beginners to complete the PSD to HTML tutorials successfully.
  • Visit the W3Schools website. All elements of HTML and CSS are explained there very precisely. You can also view that how these things are put into practice. If you read the theories from the book than you can buy a book explaining the principles of HTML and CSS. Be sure that you buy the book that contains exercises, so you can try it yourself through which you can learn more, rather than from the theories alone.
  • Go through the category pages i.e. ‘HTML tutorial’ and ‘CSS tutorial’. You can find the basic tutorials on HTML and CSS. The theories that you have read on the W3Schools website, you can put into practice here. Most of these contain video tutorials, which gives you the opportunity to practice a lot. Reading alone is not enough if you want to learn HTML and CSS! You have to be able to put it in into practice. You should make familiar yourself with all the HTML and CSS elements and properties so that you are always aware of the opportunities that you have. You must practice as many HTML and CSS tutorials as possible until you become a master of your own.
  • When you believe to have mastered HTML and CSS well, it is the time for you for more advanced tutorials. For this you can go through the website at Net.tutsplus.com. A lot of advanced tutorials can be found here very easily, which will help you to get the perfect knowledge on this regard.
  • If you have become a master with HTML and CSS than you can go on finding for the tutorials related with slicing psd files. Be aware that many of these tutorials are out of date. In these tutorials only the slice tool is used, which creates unnecessary images. If you use more images your site will load slowly. You must make sure that you slice the text on your website as little as possible. This will make it possible to minimize the images and to place them next to each other for a number of times.

Hope these above points will help you to convert PSD to HTML and CSS in a more effective manner in no time.

Ask Siri to Buy Movie Tickets in iOS 6.1

Ask Siri to Buy Movie Tickets in iOS 6.1

Apple has released Software update -iOS 6.1-which gives you the ability to purchase movie tickets through Fandango using Siri.As for Siri, Apple relentlessly continues to make progress in this technology from the future.In the recent iOS 6.1 release, Apple has empowered Siri with the ability to interface with Fandango.The result is that we are now able to have our faithful assistant find movies, help us purchase our tickets, and take advantage of the convenience Passbook gives us.

In iOS 6.1, Passbook now includes a friendlier, easy-to-understand help page with a button that links to an App Store list of downloadable apps that support Passbook. Incidentally, the Fandango app was one of the very first to support Passbook.When you purchase a movie ticket, either via the app or by way of the Fandango.com website, you are clearly presented with several options for electronic admission to the movie. One option is to have a Passbook ticket sent to you. Your movie ticket can be sent to Passbook directly via the Fandango app or via a link in Fandango's purchase confirmation email or SMS message.


20130201-01-PassbookSiri.jpg
With iOS 6.1, Siri, Fandango and Passbook collaborate to help you quickly find and purchase tickets to your movie.

Here are steps to get movie ticket :-

  1. You need to ask Siri "Where is the movie < Movie Name > playing".
  2. Siri responds by briefly showing you a list of nearby theaters playing < Movie Name > , and then shows the closest Theater and Show time. At the same time, Siri announces exactly how far away the Theater is and in what direction.

  3. 20130201-02-PassbookSiri.jpg
    Siri presents you with nearby theaters featuring your's requested movie.

  4. Siri then asks if you want to have her call the Theater, show the Directions to the theater, or skip to the next Theater featuring XYZ.
  5. By Tapping, you can select the theater. This allows to go on to purchase the ticket for the desired show time.
  6. Siri transfers you out to the Fandango app where u can complete your's purchase.

Finally, via the Fandango app confirmation page or Fandango's confirmation email or SMS, You can choose to have the movie ticket installed into your's Passbook for later use when you arrive at the theater.


20130201-03-PassbookSiri.jpg
Once the transaction is complete, your's movie ticket is ready to be scanned at the theater.