While making changes in Horde's mime_drivers.php file to allow inline HTML in emails, I noticed a setting that allows MS Word documents to be opened in an appropriate program:
/* MS Word display.
* This driver requires AbiWord to be installed.
* AbiWord homepage: http://www.abisource.com/ */
'msword' => array(
// Disabled by default
'disable' => true,
'handles' => array(
'application/msword',
'application/vnd.ms-word'
),
'icons' => array(
'default' => 'msword.png'
),
// REQUIRED: Location of the AbiWord binary
'location' => '/usr/bin/abiword'
),
In our previous email program, our text documents, including MSWord, could be previewed within the browser without downloading. There was a thread in Horde's mailing list regarding a similar setup, but the asker had a higher technical knowledge than me and seems to already have most of the pieces in place.
I'm a webmaster that only recently had to delve beyond cPanel and discover there's a whole new world keeping this website up and running! My best guess is that I need to find a program that can run on the server and convert .docx/other files to something presentable in HTML (the "abiword" referenced above, maybe?) and make the correct reference to said program in the mime_drivers.php file.
Related
I am using Catalyst::View::Wkhtmltopdf but issues are araising,
got the error
Caught exception in wealthe::View::Wkhtmltopdf->process "Void-input at /usr/local/share/perl5/Catalyst/View/Wkhtmltopdf.pm line 98."
When checked found its some issue with template, I have added the following config in myapp.pm
'View::Wkhtmltopdf' => { command => '/usr/local/bin/wkhtmltopdf',
tmpdir => '/usr/tmp',
tt_view => 'TT',
}
Template name is TT.pm under View and TT.pm is rendering correctly,
I have made Wkhtmltopdf.pm file under View with the following contents
package myapp::View::Wkhtmltopdf;
use Moose;
extends qw/Catalyst::View::Wkhtmltopdf/;
PACKAGE->meta->make_immutable();
is there anything else I need to get it working.
My experience with the PDF writing perl modules on CPAN is that every option is either:
extremely simple, but capable of only very rudimentary output
fully featured and capable of professional PDF output, but hideously complex and requiring pretty deep knowledge of PDF internals
We gave up.
Instead of trying to generate PDFs with perl natively from scratch, we attacked the problem by building the pages we wanted to render as PDF with Template Toolkit (in most cases reusing existing templates with different wrappers), and used the excellent wkhtmltopdf to handle the conversion to PDF.
Since then, Catalyst::View::Wkhtmltopdf has become available that makes this even simpler.
One of the easiest way is to create a (quite simple) HTML page then convert it to PDF: https://metacpan.org/pod/PDF::FromHTML
It needs the least amount of PDF knowledge.
The other module could create PDF on the fly but they are much more complicated: https://metacpan.org/pod/PDF::API2
I've disabled the Rss and Newsletter modules of my Magento 1.7 instance following the instructions of this post:
http://inchoo.net/ecommerce/magento/how-to-fully-disable-turn-off-magento-module/comment-page-1/#comment-65853
I just edited the app\etc\modules\Mage_All.xml file by changing to <active>false</active> in both Mage_Rss and Mage_Newsletter modules.
The problem is that when I try to load a customer page through admin panel, I get the following error:
Fatal error: Call to a member function loadByCustomer() on a
non-object in app\code\core\Mage\Newsletter\Model\Subscriber.php on
line 267
Why is it happening? Why is this code being executing even though I've disabled such module?
Thanks!
First step after disabling a module through its <active> entry. Always clear cache and if you use the compiler, recompile so you don't have code referencing classes in the disabled module.
Often the problem is not with code executing after the module is shut off through the app/etc/modules/mod_name.xml by setting <active> to false, but with other modules, templates or layouts attempting to call code in the disabled module.
Where issues come in are if another module lists the module just turned off in its dependency list. Always check all the other module xml files dependency lists for mention of the module you are deactivating.
Also, you have to check for template .phtml files that reference classes in the disabled module. This can throw the dreaded call to a non-object type exception errors. As an example, one module that provides custom cart attributes asks you to add entries to your cart templates. Shutting off the module does not get rid of the references.
Make sure no layouts are attempting to load anything referencing this module as well (custom layout local.xml).
You also might want to go to System Config, Advanced and shut the Newsletter module output off there in case the Magento Customer Account is depending on testing for the module being disabled by calling that entry instead of actually checking to see if the Module is loaded. Sometimes Magento programmers forget to do proper error trapping, which has thrown me for a loop before.
I believe I could solve the problem (not sure if generated any side effect):
Just edited the file app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tabs.php around line 90 by adding the external if clause:
if (Mage::helper('core')->isModuleEnabled('Mage_Newsletter')) {
if (Mage::getSingleton('admin/session')->isAllowed('newsletter/subscriber')) {
$this->addTab('newsletter', array(
'label' => Mage::helper('customer')->__('Newsletter'),
'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter')->initForm()->toHtml()
));
}
}
+1 if I saved your day and please let me know if you noticed and possible impact :D
In the UI, i click on button it displays the some details in new window. In this data appears in grid/table format. I'm using Selenium IDE to record & export the testcase in perl. But i'm unable to read/store those grid/table contents. How can i do it ? Can you please let me know ?
Is it possible to do it with the help of IDE commands (like getting the total number of rows & columns) ? I could only retrieve the value of the particular cell. But xpath changes for every cell, so even i can't iterate it too. Any possible ways ?
The IDE doesn't produce very maintainable tests, when I last used it there was an 'export as perl' option - use that instead of trying to convert the grid/table yourself.
If you can I'd suggest looking at using Test::WWW::Selenium::More instead, you can write very clean and modular test code like this:
use Test::Most;
use Test::WWW::Selenium::More;
my $s = Test::WWW::Selenium::More->new(
host => "localhost", # selenium server host
port => 4444, # selenium server port
browser => "*firefox",
browser_url => "http://www.google.com",
);
$s->open_ok("http://www.google.com", undef, "fetched G's site alright");
$s->type_ok( "q", "hello world");
$s->click_ok("btnG");
$s->wait_for_page_to_load_ok(5000);
$s->title_like(qr/Google Search/);
done_testing;
Have a read of the Manual and Test::WWW::Selenium which this is an extension of (anything you can to in Test::WWW::Selenium you can do in ::More).
Has anyone used the createHITType function in the Perl Amazon Mechanical Turk SDK to add Notification properties to their HIT?
I've managed to get it all working. I can grab the balance from both my sandbox account and the live system. I've successfully created new hits using the various techniques in the samples dir, but I need to enable SetHITTypeNotification, passing on properties that tell Amazon to notify me by email when someone accepts/submits a hit.
I've checked through the documentation on AWS and the rough schema would be this:
<Notification>
<Destination>me#email.com</Destination>
<Transport>Email</Transport>
<Version>2006-10-31</Version>
<EventType>AssignmentAccepted</EventType>
<EventType>AssignmentSubmitted</EventType>
</Notification>
I've done some grep'ing through the various modules looking for notification and came across the BulkSupport.pm module that seems to make reference to notifications contained as a hash within a properties object passed to the createHITType function.
I also think that it is taking these from perhaps a properties file, but I've specifically learnt Perl to use mturk along with another project, so I am now stumped to figure out what to do. I perldoc'ed the crap out of all the modules too, but there is a complete lack of documentation on implementing notifications from what I can find.
I found a solution in perl without the need of the XML structure:
my $mturk2 = Net::Amazon::MechanicalTurk->new(serviceUrl=>"prod");
my $result2 = $mturk2->SetHITTypeNotification(
HITTypeId => 'EXAMPLE00000000000EXAMPLE00000',
Notification => {
Transport => 'Email',
Destination => 'me#email.com',
EventType => 'AssignmentSubmitted',
Version => '2006-05-05'
},
Active => 'true'
);
print $result->toString;
using the module: Net::Amazon::MechanicalTurk
How can a I guarantee that no pop-up dialogs will appear when I automate Microsoft Excel through OLE? I'm using a Perl module (Win32::OLE). I can avoid most dialog pop-ups using the following code:
use Win32::OLE;
use Win32::OLE::Variant;
use Win32::OLE::Const;
my $excel_symbols = Win32::OLE::Const->Load('Microsoft Excel');
my $excel = Win32::OLE->new('Excel.Application', sub { $_[0]->Quit();} );
$excel->{'Visible'} = 0;
$excel->{'DisplayAlerts'} = 0;
$excel->Workbooks->Open('c:\some_excel_file.xls',
{ 'UpdateLinks' => $excel_symbols->{'xlUpdateLinksNever'},
'ReadOnly' => 1,
'IgnoreReadOnlyRecommended' => 1
});
However for some files, I continue to get a dialog with the following text:
This file is not a recognizable
format.
If you know the file is from another program which is incompatible with
Microsoft Excel, click Cancel, then
open this file in its original
application. If you want to open the
file later in Microsoft Excel, save it
in a format that is compatible, such
as text format.
If you suspect the file is damaged, click Help for more information about
solving the problem.
If you still want to see what text is contained in the file, Click OK.
Then click Finish in the Text Import
Wizard.
OK Cancel
Sometimes a similar dialog appears that contains 'OK', 'Cancel' and 'Help' buttons.
I cannot control the quality of files that are provided to the scripts.
You could consider using Spreadsheet::ParseExcel (albeit it may lack features you need) or Apache POI (albeit it will need some wrapping to use in a Perl script) instead of calling the Excel engine over OLE. That way you won't get any Excel-generated dialogs.
I revisited this issue and found a solution.
Copy the file before processing to a temporary location. Then save the file before closing it in Excel:
File::Copy::copy('c:\some_excel_file.xls', 'c:\temp\SFO3jfd.xls');
my $book = $excel->Workbooks->Open('c:\temp\SFO3jfd.xls',
{ 'UpdateLinks' => $excel_symbols->{'xlUpdateLinksNever'},
'ReadOnly' => 1,
'IgnoreReadOnlyRecommended' => 1
});
$book->Save();
$book->Close();
Why this works:
Excel 2003 automatically recalculates the formulas in documents that were created in an older version of Excel. Furthermore, macros could be invoked when the document is opened. All of this means that there could be changes made on a document, even though your script doesn't perform any such operations.
By saving the document before closing, you avoid the dialog requesting that you save the file. Using a temporary file ensures that the original file does not get changed during the validation operation. If you aren't concerned about this, you might consider validating in-place.
Here is full documentation for Open method. I wonder if CorruptLoad parameter is what you need.
If you are trying of process all xl files in the tree, some of them may be open by other users and have the ~ prefix.