How to add search by CTRL-F in Joomla codemirror editor

When working with template files like css in Joomla the codemirror editor is used. However, a great annoyance is that it is not possible to use the browser search (CTRL-F) to find code. When your css becomes large this can be really annoying.

There is a search addon available for codemirror however. This is how you add it to your codemirror editor in Joomla:

Download these files:

https://codemirror.net/addon/search/search.js
https://codemirror.net/addon/search/searchcursor.js

Upload the files into your Joomla and place them in the <Joomla root>/media/editors/codemirror/lib directory.

Edit the file <Joomla root>/plugins/editors/codemirror/layouts/editors/codemirror/init.php

Find the two lines (around line 19-20) looking like this:

JHtml::_('script', $basePath . 'lib/codemirror' . $extJS);
JHtml::_('script', $basePath . 'lib/addons' . $extJS);

After them, add the following lines:

JHtml::_('script', $basePath . 'lib/search.js');
JHtml::_('script', $basePath . 'lib/searchcursor.js');

Save the file and enjoy searching in codemirror using the commands described in the search addons page (like CTRL-F etc)!

Note: A future possible system update will however overwrite the changes made in init.php.

 

Solution by Stefan Helander, HelTech Communication AB.

Share

Posted by on May 19th, 2016 No Comments

Find all files and directories modified at a specific date in Linux

To find all files modified on, for example, January 21 2013:

find . -newermt 2013-01-21 ! -newermt 2013-01-22

Share

Posted by on April 30th, 2016 No Comments

Find out what real code a php eval(gzinflate(base64_decode contains

When you are dealing with a hacked or otherwise compromised website where someone has installed a backdoor or other kinds of malicious code you will often find php files with code packed into non-readable format using php eval, like eval(gzinflate(base64_decode.

To find out what the code does, copy the entire eval code (including “eval(“) into this site: http://ddecode.com/phpdecoder/

You will in the end get a human readable version of the code. Usually nasty stuff.

Share

Posted by on April 30th, 2016 No Comments

How to read a Mac disk or memory stick in a Windows computer

USB memory sticks or external disks that has been formatted on a Mac might not be readable if you connect it to a Windows computer. The reason is that the Mac has formatted it using a file system unknown by Windows.

To read the disk you can use the free tool hfsexplorer.

hfsexlorer

hfsexlorer

Share

Posted by on April 15th, 2016 No Comments

How to combine multiple .vcf files into one

If you have your contacts exported into .vcf files, they can easily be imported into for example iCloud, Google or your email program. However, if you have a couple of hundreds or thousands of contacts, and equally amount of .vcf files it will be very inefficient to import each contact one by one.

A solution is to combine all contacts into one single .vcf file. By importing the combined .vcf file all your contacts are imported at once.

To combine all .vcf files into a single one can easily be done using a Windows command prompt (cmd).

cd directory-path-where-your-vcf-files-are-located
copy *.vcf allcontacts.vcf

Now import the file allcontacts.vcf into iCloud or similar.

Share

Posted by on April 15th, 2016 No Comments

Magento2 System Upgrade fails via Setup Wizard – Error in Update!

When trying to upgrade Magento from 2.0.2 to 2.0.4 I got a windows saying Update in progress and the last line from the system log says “./composer.json has been updated” then nothing more happens for quite a long time. Finally an error screen displays “Error in Update!”.

To restart the update process while trying to figure out the error i had to manually delete the files var/.maintenance.flag and var/.update_in_progress.flag.

Magento System Upgrade error

Magento System Upgrade error

To make Magento run in Apache we had set php.ini for the web user to memory_limit=1024M and according to instructions, the cron jobs should be called with the -c pointing to the php.ini used by the web server, in our case /etc/php5/fpm/php.ini.

No error message revealed why the update failed but I found out that the php.ini we used for cron (/etc/php5/fpm/php.ini) had a memory_limit=128M. By editing this file and increasing it to 1024M the update worked.

Share

Posted by on April 12th, 2016 No Comments

Magento and always_populate_raw_post_data readiness test fails

When running the Magento readiness test it failed with the message that always_populate_raw_post_data should be set to -1 since it is running under php 5.6. Even though I tried different methods of setting it to -1 and I could verify it by calling phpinfo(); Magento still complained.

The way I solved is a bit rough and it required that I had full system administrator access to the machine (which I had because it was a dedicated server). This is how I solved it:

echo "always_populate_raw_post_data=-1" > /etc/php5/mods-available/always_populate_raw_post_data.ini
php5enmod always_populate_raw_post_data
service php5-fpm restart
service apache2 restart

Share

Posted by on April 7th, 2016 No Comments

Magento “Cron readiness check failed” solved

First of all, check the Magento guide on this problem here.

In my case, at first I didn’t get any errors in the cron logs in <web-root>/var/log. When running the scripts by hand as the website user I got the not so informing “Cron readiness check failed” in the <web-root>/var/log/update.cron.log.

The reason the “Cron readiness failed” was actually due to some files in the file and directory structure in the web root that can not be written by the cron update script. In my case I used the AWstats package to create website statistics placed in a directory called /stats. This directory and it’s file was not writeable by the cron script, causing it to fail, even though the directory /stats and it’s files are not a part of Magento.

I discovered this by investigating the content of the file var/.update_cronjob_status. In this file you can find important information on why the cron update script is failing.

Share

Posted by on April 5th, 2016 No Comments

postgrey whitelisting outlook.com

Greylisting is a way of reducing the amount of incoming spam and virus emails, in addition to other counter measures. Postgrey is a good choice if you are running postfix.

However, to be able to recieve emails from senders using outlook.com you need to whitelist it. This is because outlook.com is using a different host on each try to deliver the mail, causing delays up to hours, days or the mail not being delivered at all within time limits.

Create/edit the file /etc/postgrey/whitelist_clients.local and add:

# outlook.com
/^mail-*\.outbound\.protection\.outlook\.com$/

Then execute:

service postgrey reload

Share

Posted by on April 1st, 2016 No Comments

How to export mailman mailinglist subscribers

There is no built-in function to export the mailinglist subscriber in mailman. If you want to migrate to another software or move to another mailman installation you are in need to export the subscribers. I found this to be the easiest way:

  1. Log in to your mailman mailinglist administration panel, like http://hostname/cgi-bin/mailman/admin/mylist
  2. Replace “admin” with “roster” in the URL in the address bar and press enter, like http://hostname/cgi-bin/mailman/roster/mylist
  3. The subscribers are listed in a bulleted list with the @ sign replaced by ” at “. Mark the list in the browser, right click the selection and “Copy”
  4. Open a plain text editor, like notepad if you are running Windows (avoid Word, Wordpad, LibreOffice writer etc since you will also paste a lot of text attributes in those editors, use a plain text editor)
  5. Right click in the editor and select “Paste”
  6. Search and replace, normally by pressing CTRL-H. Search for ” at ” and replace it with “@” (without the “”) and click “Replace all”.
  7. Save the file

If you are moving the subscriber list into another mailman installation:

  1. In the text editor above, right click and “Select all” to select all text (the list of the subscribers) and then right click and “Copy”
  2. In the administration panel of the new mailman installation, click on “Membership management
  3. Click on “Add new members to the list
  4. In the top box where you can type email addresses one per line, right click and “Paste”
  5. Set “Send welcome message to new members” to “No” (unless you really want mailman to send an email welcoming all the subsrcibers you are adding)
  6. Click “Save” in the bottom of the page
Share

Posted by on March 31st, 2016 No Comments