|
Friday, 30 December 2011 16:01 |
|
Not only am I a newbie to Sublime Text 2 but I'm about as competent in Python as well. That said, using the "infinite monkeys typing"-method of coding, I got this CodeSniffer plugin to work eventually:
import os
import sublime
import sublime_plugin
class PhpcsCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command("save")
folder_name, file_name = os.path.split(self.view.file_name())
self.view.window().run_command("exec", {'cmd': ['/usr/local/bin/phpcs', '--standard=zend', \
'--tab-width=4', file_name]})
sublime.status_message("CodeSniffer executed on " + file_name)
Of course, you should improve/mutilate/bow down in thanks/cast aspersions at this code as you see fit. |
|
Tuesday, 13 July 2010 16:16 |
|
If you've created a pdf in your custom Joomla component, then you might notice that the scaling of those images isn't usually what you expected. Here's some quick code to deal with it.
The issue starts with a hard-coded value in libraries/joomla/document/pdf/pdf.php. Around line 41, you should see var $_image_scale set to 4. This value is then used to set the image scale within the tcpdf object after it's initialized. The problem is that, at least in my case, I don't want my images scaled way down. Maybe this was a way to account for print images that had a resolution of 300dpi. I'm not sure. All I know is that my pdfs all had graphics that once look decent in html, then appeared to be postage stamps.
If your component has a view.pdf.php, you can rectify this. Below is the code I used to "re-inflate" my images.
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.view');
/**
* PDF View class for the Somecomponment component
*/
class SomecomponmentViewViewname extends JView {
function display($tpl = null) {
$document = &JFactory::getDocument();
// set document information
$document->setTitle("Some Title");
$document->setName("sometitle");
$document->_engine->imgscale = 1;
$this->assignRef('somevariable',$somevariable);
parent::display($tpl);
}
}
Maybe this code would work in a template override so you could alter the pdf output for com_content. You just need the lines that specifically reference $document.
As usual, hack, alter, ignore, ridicule, praise this code as you see fit. |
|
Tuesday, 07 April 2009 13:21 |
|
This isn't really news for anybody that loosely keep track of Mac news, but for redundancy's sake, I'll post my blurb. MacHeist is having their annual "killer" bundle sale.
I'll do reviews of each piece of software as I get to it. I think I have 12-14 new apps so it could take a while...
In any case, I'm having a good time with Times. It's an nice, easy way to read all the RSS feeds I've been accumulating. I think it's going to become even more useful as RSS and social networking are growing hand-in-hand.
I've been using Apple's Mail for my feeds which, while convenient because I'm always in Mail, has a pretty bare bones UI so overall it's probably not a win. I have a feeling that Times is going to actually make the process a little more efficient.
The only thing that irked me out-of-the-box is that I couldn't find an intuitive way to sort my feeds within the same "column". It kept defaulting to some bogus order that wasn't apparent. Maybe it's based on the order of the feeds as they are imported/added? Not sure, but whatever is up, I didn't figure it out in 30 seconds (and yes, I at least checked the Help menu), so I'll probably pester their support or forum when I get a chance. |
|
Friday, 30 January 2009 01:04 |
|
Here's a MAMP specific hack for finding what MySQL queries are killing your application.
First, backup /Applications/MAMP/bin/startMysql.sh
Next, pop open /Applications/MAMP/bin/startMysql.sh in your favorite text editor
You should see something like this:
# /bin/sh
/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log &
You want to add in this string to that command:
--log-slow-queries=/Applications/MAMP/logs/slow_query_log
So the file contents should look like:
# /bin/sh
# /bin/sh
/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-slow-queries=/Applications/MAMP/logs/slow_query_log --log-error=/Applications/MAMP/logs/mysql_error_log &
Save out the file, restart MAMP, start hitting pages and monitor the file, /Applications/MAMP/logs/slow_query_log
This should be fine for MAMP 1.4.1. YMMV may vary, depending on your MySQL version. The concept is the same, but the syntax can change in later versions. |
|
Saturday, 20 December 2008 23:23 |
|
You might want to implement this tweak to your Virtuemart files in order to avoid Google complaining about your product pages containing identical meta descriptions.
I am not a Virtuemart expert and I might end up finding a config that gets around this. However, when I first set up my store I noticed that the product pages all contained a default meta description. The category pages grabbed the category descriptions just fine but the product pages needed help.
Open up /components/com_virtuemart/themes/default/templates/product_details/flypage.tpl.php in vi/emacs/TextEdit/whatever. All you need are the following 2 lines:
$document =& JFactory::getDocument();
$document->setDescription($product_name . ": " . strip_tags($product_description));
I would place these near the top of the file, possibly just after
mm_showMyFileName(__FILE__); |
|
|
|
<< Start < Prev 1 2 3 4 5 Next > End >>
|
|
Page 1 of 5 |