Your web-browser is very outdated, and as such, this website may not display properly. Please consider upgrading to a modern, faster and more secure browser. Click here to do so.
Wow, just discovered the -n 0 argument of tail, making it
tail -n 0 -f /var/log/lighttpd/php_error.log
Now I finally get an empty/clean start of tail.
2 notes View comments
So much for the easy setup of Redmine, our server gazed at me with a 500 Internal Server error the following monday morning.
To track down the error, I started out by tailing Redmine’s error log that I previously defined in /etc/lighttpd/lighttpd.conf, showing:
$ tail -f /var/log/lighttpd/redmine_error.log
2010-12-20 12:09:04: (mod_fastcgi.c.2582) unexpected end-of-file (perhaps the fastcgi process died): pid: 6425 socket: unix:/tmp/redmine.socket-0
2010-12-20 12:09:04: (mod_fastcgi.c.3367) response not received, request sent: 909 on socket: unix:/tmp/redmine.socket-0 for /dispatch.fcgi?, closing connection
2010-12-20 12:09:04: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/redmine.socket-3
2010-12-20 12:09:04: (mod_fastcgi.c.3037) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
What I did to solve it was (after some googling) to change the lighttpd conf setting for Redmine’s socket from /tmp/redmine.socket to /tmp/lighttpd/redmine.socket. Before I could do that, I had to
$ sudo mkdir /tmp/lighttpd
$ sudo chown -R www-data:www-data /tmp/lighttpd
to make sure it was going to be writable. Restarting lighttpd after that seems to have solved the issue, permanently I hope.
View comments
I just finished the installation of the project tool Redmine and will be enjoying using it soon.
However, the official installation hints were far from good, in fact, they previously led me to an aborted installation session. Really annoying.
Instead, I used the perfectly concise and error free guide called:
Redmine 0.9.3, Ubuntu 9.10, Lighttpd 1.4.x, MySQL 5.1.x - jonathanrobson.me
The only diversion was that I installed the 1.0.4 version of Redmine, which seems to be the latest one.
View comments
I’m currently setting up a new dev server at work. This includes hands-on work such as writing PHP organized in namespaces, but at a more technical level, modifying lighttpd and installing lots of packages on a Ubuntu server.
The dev server which is being deprecated is equipped with svn & trac, which has been really nice, especially for browsing the source code, code reviews and managing tickets, so the goals are set for this new server.
Gitweb will correspond to the demands for viewing source code, diffs and branches. Installing it and getting it up on lighttpd was a breeze, thanks to the guide How to setup gitweb with lighttpd on Ubuntu - jonathanrobson.me.
I used his config with some tweaks. The $projectroot variable in /etc/gitweb.conf now points at a directory which has a clone of each of our reposes. I.e.
$ cd /home/git/projects
if /home/git/projects/ is where you store all of your repositories, in a common place as a base for your dev or stage area. Read my entry Using git init —bare for a slim repository look for a directory layout that works.
If you followed my approach,
$ ls /home/git/projects
should only consist of directories called project-1.git, project-2.git and so forth. This is ideal for gitweb, which prefers to have a single directory to check for git repositories. (Check jonathanrobson’s link above for the whole shebang.)
There’s a github repository on https://github.com/kogakure/gitweb-theme which has an easily installed theme that looks much better than the original bundled with gitweb.
View comments
Very easy way of minimizing a few bytes of every request using Google’s Closure Compiler which is a java program for compressing javascript.
$ curl -0 http://closure-compiler.googlecode.com/files/compiler-latest.zip
$ unzip compiler-latest.zip -d ~/Applications/closure-compiler ; cd ~/Applications/closure-compiler
$ echo "// A simple function.
function hello(longName) {
alert('Hello, ' + longName);
}
hello('New User');" > hello.js
$ java -jar compiler.jar --js hello.js --js_output_file hello-compiled.js
$ cat hello-compiled.js
function hello(a){alert("Hello, "+a)}hello("New User");
$ wc -c hello.js
101 hello.js
$ wc -c hello-compiled.js
56 hello-compiled.js
$ curl -0 http://closure-compiler.googlecode.com/files/compiler-latest.zip
Download the good stuff
$ unzip compiler-latest.zip -d ~/Applications/closure-compiler ; cd ~/Applications/closure-compiler
Locate the executable in a standard location and go there
$ echo "// A simple function.
function hello(longName) {
alert('Hello, ' + longName);
}
hello('New User');" > hello.js
Create a file with valid javascript in it
$ java -jar compiler.jar --js hello.js --js_output_file hello-compiled.js
Use the recently unzipped compiler.jar to take input from hello.js and generate its optimized version at hello-compiled.js. Note that there’s only one file to use, compiler.jar. Usable.
$ cat hello-compiled.js
function hello(a){alert("Hello, "+a)}hello("New User");
Dump the contents of the newly created file, just to verify what a minified javascript file could look like
$ wc -c hello.js
101 hello.js
$ wc -c hello-compiled.js
56 hello-compiled.js
Comparing bytes in each file shows almost 50% winnings, both in terms of lowering the storage needed but also for each request of that file.
View comments
Until now, I’ve mainly worked alone with my git repositories. Sometime pushing to my github-account, but always using the service as a kind of backup solution. Until now. At work, we’re setting up our new environment with git and I’m lucky enough to learn it while doing it.
This setting will differ quite a lot from what I’m used to:
Also, exercising a plain git init routine creates a complete repository with all source files, branches & stuff; which really are ment to keep track off and develop in. Let’s not, let’s just keep the repository there and only git push there so all development will be done in each user’s local repository.
Let’s get to the good stuff:
# create a user named 'git' and make that user the owner of your repositories, and nothing else
$ mkdir -p /home/git/repositories
$ cd /home/git/repositories
$ mkdir your-project.git && cd your-project.git
$ git init --bare
$ git config receive.denyCurrentBranch "ignore"
$ mkdir -p ~/www/your-project && cd ~/www/your-project
$ echo "lalala, random file" > random.txt && git add . && git commit -m "First commit"
$ git remote add origin /home/git/repositories/your-project.git
$ git push origin master
There you go, a fully capable external repository, local on your dev machine, ready to export to a staging/testing/Q&A-setting. For an easy setup of this, go read Using Git to manage a web site which worked out of the box for us.
If you get any errors whilst doing this, google it or just try to parse it (for us, it mostly came down to chown- and chmod-ing the -R /home/git/repositories/ folders, so using sudo helps a lot).
View comments
SELECT turtle, pizza, rating FROM heroes ORDER BY FIELD(turtle, ‘Donatello’, ‘Michelangelo’, ‘Raphael’, ‘Leonardo’)
This let’s you get the ratings of Donatello’s first, etc. Really practical.
View comments
Just finished fineprint which is a jquery plugin that let’s the developer direct the user’s attention towards small fragments of your very large document. It’s easily customizable and let’s you drop it on an already functional page, being truly unobtrusive.
The project is up and running on github: https://github.com/chelmertz/fineprint which includes full source, documentation and a couple of demos.
1 note View comments
Insight: symlinks should really be abused!
Let’s say you’re in the same position as me, working within a large codebase that requires focus over multiple folders* even for working with just one project. Perhaps you need to add logic, content, conditions, markup and css. These areas should all be separated, so naturally you’ll be clicking/cd-ing a lot… you see where this is going, right?
Make a temporary, meaningless folder named YourProject2010 and start pulling symlinks into it so you’ll never have to leave home again :) That would mean something like this:
cd /var/www/your-dev/YourProject2010
ln -s /var/www/your-dev/css/campaign_file.css .
ln -s /var/www/your-dev/js/campaign_file.js .
ln -s /var/www/your-dev/lib/campaign_file.php .
When you’re all done with the project, merging your branch with master and
rm -r /var/www/your-dev/YourProject2010
are the only two steps you need wipe out your traces and tell your boss that “it was a hard project to pull off because of its scope”.
View comments
Page 1 of 7