RSS
 

Posts Tagged ‘webdevelopment’

Serve.sh – A shell script for serving sites

28 Apr
This entry is part 1 of 2 in the series Serve.sh

I am experimenting with using a Linux virtual machine as my web development environment of choice. I store the vm on a removable drive so that I can develop from any location, without having to setup a working environment. Previously I had to check out the repositories, setup a local webserver and I had trouble keeping things working, because every configuration change had to be applied in every location. Now it is all centralized and my life is simpler.

The aim is to make working on projects as easy as possible. I have all projects checked out in a folder called /var/sites. They are mostly PHP projects and because of my shared hosting environment they share a single apache configuration. How can I easily serve them? Having seperate virtualhosts for each project would result in me having to make manual changes on every location again, so this was not the way to go.

Instead I created a simple shell script that creates a symbolic link from the Apache’s webroot to the project I am working on:

#!/bin/bash
echo "Available sites:"
ls  /var/sites
echo
echo -n "Type site to serve: "
read site
if [ -z "$site" ]
then
exit
fi
sudo rm /var/www
sudo ln -s /var/sites/$site /var/www
 
Comments Off

Posted in Uncategorized

 

Intranet Migration Strategy

13 Apr

Next week we’re turning off our old intranet site so I have setup a “Migration Switch” and a redirection page so that from the moment we turn off the site people will not be able to access it. Because if we actually turn off the site we would receive phonecalls with people needing access to their lost data, and because certain parts of the old intranet are reused in our new one, we instead check if the page is embedded, and if it’s not check that the user is on a whitelist of specifically allowed users (us). If this is not the case we redirect them.

Next week we will remove all navigation links to the old intranet, turn on the switch, and remove the documents from the search indexer on the (new) intranet. There must be better terminology for old and new intranet.

Hopefully this will ensure that everything works smoothly.

 
Comments Off

Posted in Uncategorized

 

Rotate PHP logs

28 Feb

Our php.log was nearing 550MB so I was investigating how to rotate the logs. The easiest solution seems to be using logrotate (ubuntu linux) with a script like folows. sudo nano /etc/logrotate.d/php5

/var/log/php5/*.log {
#rotate daily
daily
# keep 14 days
rotate 14
 missingok
 nocompress
 sharedscripts
 postrotate
 apache2ctl graceful
 endscript
}

Make sure that log_errors = /var/log/php5/php_errors.log in php.ini and that the file exists and is chmod 777.

Thanks to the following article that helped me going: Logrotate | PHP vs .Net.

 
Comments Off

Posted in Uncategorized

 

When is it SQL Server RAM Upgrade Time?

28 Feb

How do you know you need more RAM?

Take a look at your Buffer Cache Hit Ratio, ideally you want to be at 95% plus.

via Less Than Dot – Blog – The SQL Server Memory Leak Confusion.

 
Comments Off

Posted in Uncategorized

 

Subversion repository creation rule

21 Oct

Do not use capitals for repository names!
Because when checking out a working copy you will have to specify the respository url case sensitive. Failing to provide the correct case sensitive name result in things might appear to work but you might get access forbidden messages for certain users in some point, and other mysterious errors, such as the svn commit error below:

access to ‘/svn/project/!svn/act/c50e0f11-eec3-154a-9695-20ec222ad7f3′ forbidden

 
Comments Off

Posted in Uncategorized

 

Windows Integration Authentication Scheduled Web Page

31 Aug

This is a problem I have been trying to solve for some time on and off. Under Windows/IIS I need to periodically run a webpage that uses Windows Integrated Authentication. This rules out most of the VBS scripts and WGet solutions. I got it to work today using a batch file like below. Just add it as a scheduled task.

start /min "C:\Program Files\Internet Explorer\iexplore.exe" http://domain.com/webpage
PING 1.1.1.1 -n 60 -w 60000 > NUL
taskkill /F /IM iexplore.exe

The two most important parts is starting the application with the ‘start’ command (windows 2003 server in this case) so that the batch file will continue while the program is running. We then use a trick by pinging every second for 60 seconds (1 minutes) to wait for the webpage to finish what it’s doing. Finally we kill off the original program.

 
Comments Off

Posted in Uncategorized

 

[Plugin: WP List Files] Fix: links don’t work when blog not installed in root of site

26 Jun

wp-list-filesWe’re using a customized version of WordPress as an electronic portfolio for students and we are using WP List Files to make documents available on the eportfolio. Unfortunately the WordPress support forums seem to delete my topic (possibly because it’s an older version) and the author is no longer supporting the plugin.

Due to time constraints, these plugins are no longer supported and will not be updated, ever! Unless you know what you’re doing, I strongly discourage using these on a production blog since they have not been tested since WordPress 2.5.

The plugin didn’t work in version 2.0.3 that we are using because the wp_enqueue_script function does not exist in this version  (the codex page does not say when this function was added). Anyway after manually adding the javascript to the theme’s head element the plugin almost worked fine – links didn’t take our folder structure into account.

works:
joeblogs.com</dir specified in post or page>

doesn’t work:
allblogs.com/blogs/joebloggs</dir specified in post of page>

Fix it by replacing line 231 to read:

$files .= ‘<li><a href=”‘.get_bloginfo(‘wpurl’).$item['link'].’”>’.$itemName.’</a>’.

The hyperlink created for the item didn’t have the complete blog url in it it assumed the blog was installed in the root of the domain. After this fix the plugin works fine.

 
Comments Off

Posted in Uncategorized