In 2008 when I worked with some Oracle databases under Solaris and AIX, I spent some time to figure out how to make the database backup and restore and decided to use cold backup as the most straightforward method. As far as I remember, to backup the database I shutted down Oracle and then simply archive the database files using “zip” command. To restore the database I used the following shell script that extracts archived files and adjust some Oracle settings:
Restricting the access to phpmyadmin in Apache 2 on Ubuntu
By default Apache 2 is configured in a way that phpmyadmin is automatically included to all the hosted web sites. For example, if I create a new site ‘site.com’, and then navigate to this address:
http://site.com/phpmyadmin
the phpmyadmin login page appears.
How to remove ID from URL in Joomla 2.5-3.7
There is a new option in Joomla 3.8.2 allowing to get rid of ID in URLs (thanks to Ian who discovered it). If you have an older Joomla version and unable to update to 3.8.2 or higher follow the steps provided below:
Open components\com_content\router.php in an editor and make a small changes:
in function ContentBuildRoute(&$query) replace line 27
$advanced = $params->get('sef_advanced_link', 0);
with
$advanced = $params->get('sef_advanced_link', 1);
in function ContentParseRoute($segments) replace line 208
$advanced = $params->get('sef_advanced_link', 0);
with
$advanced = $params->get('sef_advanced_link', 1);
How to setup Eclipse with PHP Developer Tools and FTP support
Using Eclipse as PHP IDE
After working a little with phpDesigner, I felt that, probably, I need more complex PHP IDE. Because I previously worked with Java applications using Eclipse I decided to add PHP support to my existing Eclipse for Java EE (Helios) installation previously downloaded from http://www.eclipse.org/downloads/. I navigated to Help->Install New Software in Eclipse, selected “–All Available Sites—“, searched for “php” and got the same plugin in three different categories:
Change the size of virtual memory under Widows 7
On my PC with 6GB of RAM under Windows 7 the paging file size is set to 6014 MB by default (its initial size is equal to amount of RAM, as follows from article Change the size of virtual memory on Microsoft’s website):
Using ADO.NET Entity Framework with MySQL
In general, getting EF work with MySQL is a fairly simple task, that could be accomplished by downloading and installing ADO.NET driver for MySQL. But what concerns to me, it taken me about four hours to clarify some MySQL-specific details that affect generation of associations in Model Designer. Also after doing an experimentation with the code I realized that ADO.NET driver for MySQL, as well as other third party ADO.NET drivers, do not support “MARS” and, as far as I see, this significant restriction makes EF unusable with MySQL in large real-life projects. Please read below if you interested in more information on this questions.
(more…)
Investigating VirtueMart 2.0 – part I
Recently I have started investigating VirtueMart 2.0.6. Below I recorded various issues that I have found along the way. Hopefully someone else (possibly myself down the line) will find these useful.
Configuring “Safe Path”
Create directory /home/test1/vmfiles:
mkdir /home/test1/vmfiles
Go to Configuration->Templates, enter the path:
and press Save button.
Seeing design time data in a WPF control
Sometimes the ability to see the data at design time significantly facilitates the creation of WPF controls. If I am developing a WPF control with complex UI using data bound controls, I usually define a property for accessing some typical data item:
public static ComplexData DesignTimeItem { get { using (DatabaseContext db = new DatabaseContext()) { var products = from p in db.products.Include("ProductType") where p.product_id == 131 select p; product product = products.First(); return new ComplexData(product, "100 kg"); } } }
Securing Apache web server on Ubuntu Linux
Running Apache virtual hosts as different users
By default, Apache on Ubuntu executes all PHP scripts under www-data user, hence in situations where multiple mutually distrusting users have the possibility to put their PHP scripts on the server they could potentially spy on each other private data.
For example, the user user1 could put a PHP script that access file ‘file1.txt’ belonging to user2:
echo file_get_contents("/home/user2/www/file1.txt");
Adding footers and meta tags to WordPress posts
Adding post footer
There are a lot of plugins for adding footers to WordPress posts and one of them is so called “Add Post URL” plugin written by some Chinese guys. From my perspective, its benefits includes macros support and ability to decide whether or not to display the footer for each post individually. It worked fine for me and I even improved it a little bit. The following code snippet shows how I added “post_id” macro:
$footer_text = $posturl_options['footer_text']; $footer_text = trim($footer_text); if (!empty($footer_text)) { //remove_filter( 'the_content', 'wpautop' ); $post_id = get_the_ID(); $footer_text = str_replace("%post_id%", $post_id, $footer_text); $footer_text = str_replace("%site_url%", site_url('/'), $footer_text); $footer_text = str_replace("%site_name%", get_bloginfo('sitename'), $footer_text); $footer_text = str_replace("%post_url%", get_permalink(), $footer_text); $footer_text = str_replace("%post_title%", the_title('', '', false), $footer_text); $footer_text = stripslashes($footer_text); $text .= $footer_text; }