cyprich.com

By

Installing WordPress from the Command Line

How to install WordPress from the command line in Linux.

Read More

By

Using Microsoft Office MIME Types with MailKit

Recently I had problems with attaching a macro-enabled Excel workbook to an email. When it was received, the macro’s didn’t run correctly on the latest version of Microsoft Office. It did run correctly on Excel 2007. The workbook was being corrupted in the encoding into the email or decoding when its downloaded.

The following code will maintain the integrity of the Excel workbook when attached to an e-mail:

ContentType xlsmContent = new ContentType ("application/vnd.ms-excel.sheet.macroEnabled.12", "octet-steam");
builder.Attachments.Add ($"{Directory.GetCurrentDirectory ()}/Temp/workbook.xlsm", xlsmContent);

These are the MIME types for documents in Microsoft Office:

Ext MIME Type
.doc application/msword
.dot application/msword
.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template
.docm application/vnd.ms-word.document.macroEnabled.12
.dotm application/vnd.ms-word.template.macroEnabled.12
.xls application/vnd.ms-excel
.xlt application/vnd.ms-excel
.xla application/vnd.ms-excel
.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template
.xlsm application/vnd.ms-excel.sheet.macroEnabled.12
.xltm application/vnd.ms-excel.template.macroEnabled.12
.xlam application/vnd.ms-excel.addin.macroEnabled.12
.xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12
.ppt application/vnd.ms-powerpoint
.pot application/vnd.ms-powerpoint
.pps application/vnd.ms-powerpoint
.ppa application/vnd.ms-powerpoint
.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
.potx application/vnd.openxmlformats-officedocument.presentationml.template
.ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow
.ppam application/vnd.ms-powerpoint.addin.macroEnabled.12
.pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12
.potm application/vnd.ms-powerpoint.presentation.macroEnabled.12
.ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12

By

The Best First Programming Language to Learn

Read More

By

The Will To Win Speech – By Vince Lombardi

Winning is not a sometime thing; it’s an all the time thing. You don’t win
once in a while; you don’t do things right once in a while; you do them
right all the time. Winning is a habit. Unfortunately, so is losing.

There is no room for second place. There is only one place in my game, and
that’s first place. I have finished second twice in my time at Green Bay,
and I don’t ever want to finish second again. There is a second place bowl
game, but it is a game for losers played by losers. It is and always has
been an American zeal to be first in anything we do, and to win, and to win,
and to win.

Every time a football player goes to ply his trade he’s got to play from the
ground up – from the soles of his feet right up to his head. Every inch of
him has to play. Some guys play with their heads. That’s O.K. You’ve got to
be smart to be number one in any business. But more importantly, you’ve got
to play with your heart, with every fiber of your body. If you’re lucky
enough to find a guy with a lot of head and a lot of heart, he’s never going
to come off the field second.

Running a football team is no different than running any other kind of
organization – an army, a political party or a business. The principles are
the same. The object is to win – to beat the other guy. Maybe that sounds
hard or cruel. I don’t think it is.

It is a reality of life that men are competitive and the most competitive
games draw the most competitive men. That’s why they are there – to compete.
To know the rules and objectives when they get in the game. The object is to
win fairly, squarely, by the rules – but to win.

And in truth, I’ve never known a man worth his salt who in the long run,
deep down in his heart, didn’t appreciate the grind, the discipline. There
is something in good men that really yearns for discipline and the harsh
reality of head to head combat.

I don’t say these things because I believe in the “brute” nature of man or
that men must be brutalized to be combative. I believe in God, and I believe
in human decency. But I firmly believe that any man’s finest hour, the
greatest fulfillment of all that he holds dear, is that moment when he has
worked his heart out in a good cause and lies exhausted on the field of
battle – victorious.

By

Add Contact to Maximizer Address Book with PHP

The class below is an example how to post data from a web form to the address book in Maximizer. The first thing you need to do is create a Web Form in Maximizer (Administration -> Web Forms). The PHP class below uses the fields that were created for the form (your form will have different fields). The class uses the “name” from <input> in the Maximizer Web Form for the PHP SaveToAddressBook() method. You also need to pass the “action” string from the <form> to the method. When the method is called, it won’t be displayed on the web page since its hidden by CSS, and its submitted automatically by a JavaScript button press.

The Maximizer generated Web Form isn’t complicated. If you remove all of the styling and validation code, you can easily use the <input> fields in any web application. The class below only has the essential code for posting the form.

—[ code ]———————————–

<?php

class MaxLibrary
{
// This is the “action” string in the <form> declaration.
private $_action;

// These are for the <input> fields in the form.
private $_first_name;
private $_last_name;
private $_company;
private $_phone;
private $_email;

public function __construct ($action, $first_name, $last_name, $company, $phone, $email)
{
$this->_action = $action;

$this->_first_name = $first_name;
$this->_last_name = $last_name;
$this->_company = $company;
$this->_phone = $phone;
$this->_email = $email;
}

///////////////////////////////////////////////////////////////////////////////////////////////
// Load form with data and automatically press submit button to send data to Maximizer.
// The “name” in the <input> statements in this function must match the name in Maximizer
// generated form.
///////////////////////////////////////////////////////////////////////////////////////////////

public function SaveToAddressBook ()
{
?>
<div style=’display: none;’>
<form name=’form_maximizer’ method=’post’ action='<?php echo $this->_action; ?>’>
<input name=’C0IFirstName’ type=’text’ value='<?php echo $this->_first_name; ?>’><br>
<input name=’C1ILastName’ type=’text’ value='<?php echo $this->_last_name; ?>’><br>
<input name=’C2ICompanyName’ type=’text’ value='<?php echo $this->_company; ?>’><br>
<input name=’C3IPhone1′ type=’text’ value='<?php echo $this->_phone; ?>’><br>
<input name=’U4I58850′ type=’text’ value='<?php echo $this->_email; ?>’><br>
</form>
</div>

<script type=”text/javascript”>
window.onload=function ()
{
document.forms[‘form_maximizer’].submit();
}
</script>
<?php
}
}