How can I break up this long line in Python?

How would you go about formatting a long line such as this? I’d like to get it to no more than 80 characters wide: logger.info(“Skipping {0} because its thumbnail was already in our system as {1}.”.format(line[indexes[‘url’]], video.title)) Is this my best option? url = “Skipping {0} because its thumbnail was already in our system as … Read more

php Replacing multiple spaces with a single space [duplicate]

This question already has answers here: How can I convert ereg expressions to preg in PHP? (4 answers) Closed 2 years ago. I’m trying to replace multiple spaces with a single space. When I use ereg_replace, I get an error about it being deprecated. ereg_replace(“[ \t\n\r]+”, ” “, $string); Is there an identical replacement for … Read more

Format date and time in a Windows batch script

In a Windows (Windows XP) batch script I need to format the current date and time for later use in files names, etc. It is similar to Stack Overflow question How to append a date in batch files, but with time in as well. I have this so far: echo %DATE% echo %TIME% set datetimef=%date:~-4%_%date:~3,2%_%date:~0,2%__%time:~0,2%_%time:~3,2%_%time:~6,2% echo … Read more

Why does WP not like my container?

Lately I’ve been working on some shortcodes where all the elements the shortcode produces are wrapped inside an tag. Unfortunately this is not rendered like wanted, because of the filter wpautop on the_content or whatever you’re using to display shortcodes and/or regular content. The setup Imagine that we created the following shortcode: <?php function example_shortcode($atts, … Read more

Keep pasted pre formatted code as it is -with tabs- in visual editor

I need a manual code to my functions php to extend the visual editor from removing tabs when pasting code blocks. I tried this code, found at this site, but it does not work as I want. If I got: add_filter(‘tiny_mce_before_init’, ‘tiny_mce_before_init’); function tiny_mce_before_init($init) { $init[‘setup’] = “function(ed) { ed.onBeforeSetContent.add(function(ed, o) { if ( o.content.indexOf(‘<pre’) … Read more