Weblog Home Web site's Home Clip art Search Clker.com – Available downloads RSS

Archive for the ‘Internet programming’ Category

Apache hanging once in a while – caught the culprit

Sunday, April 19th, 2009

My server has been suffering from unexplainable apache hangs. Once in a while, apache would stop accepting new connections. It will keep running in memory but all incoming connections will timeout. Since then, my only solution was a bash script that runs every minute and tries to read a text file from the website. If it fails, it would restart apache.

On Fri evening, I replaced APC with Memcache. Although I know that Memcache is little bit slower than APC due to lots of reasons including network overhead, yet it was APC’s turn to get tested in the sequence of tests I’ve been running. It seems that APC was the reason apache was hanging. I know that some big websites like facebook use APC, but maybe they are using a different version. I also know that youtube is using memcahe, so APC was one of my least suspects. The server has been running for the past 48 hours without a crash or a hang, which is more than its average. Usually, it used to hang once every 20 hours or so.

Since I had my own caching functions, that finally called APC, the amount of code changes were very small. Hopefully it will continue running without problems.

actionscript mode for emacs

Monday, October 27th, 2008

I’ve been playing around with flex for a while now. I was able to setup a compile environment under liux using emacs, a Makefile.

I also found a mode for emacs to highlight actionscript 3 files here. It missed a hook, which will automatically set the actionscript-mode if a file of extension .as was loaded & could not find a way to comment on their blog, so it’s here for reference.

(setq auto-mode-alist (cons ‘(”\\.as$” . actionscript-mode) auto-mode-alist))

GNUPlot wordpress plugin v1.1

Friday, July 18th, 2008

Plots GNUPlot charts without GNUPlot on your server. This plugin communicates with our custom version of GNUPlot hosted at clker.com, and responds with a PNG chart or errors in case of errors.

Write your GNUPlot code between [ gplot] and [ /gplot] (without spaces). Maximum chart size is 1×1.

To install

  1. Copy the file ( gnuplot plugin ) in you wp-content/plugins directory, and rename to .php instead of .phptxt.
  2. Create wp-content/cache directory, and make sure it is write able to the webserver
  3. Activate the plugin from the plugins tab inside wordpress

Example:

[ gplot]

set size 1,0.7
set dummy u,v
unset key
set parametric
set view 60, 30, 1.1, 1.33
set isosamples 50, 20
set title "Interlocking Tori - PM3D surface with depth sorting"
set urange [ -3.14159 : 3.14159 ] noreverse nowriteback
set vrange [ -3.14159 : 3.14159 ] noreverse nowriteback
set pm3d depthorder
splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d,\
1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d

[/ gplot]

would produce this:

… Enjoy

GNUPlot wordpress plugin

Wednesday, July 16th, 2008

Newer version is here

While I was writing the repeated images identification post, I modified the mimetex wordpress plugin to be the GNUPlot wordpress plugin.

The plugin executes GNUPlot over any portion of the text enclosed between [ gplot] and [/ gplot] tags, without the spaces of course.

Example:

[ gplot]

set size 0.75, 0.3

set xrange[0:5]

plot sin(x) title “sin(x)”, sin(2*x) title “sin(2x)”

[/ gplot]

would generate:

Download: Download the GNUPlot plugin for wordpress

Installation:

- Make sure that your server has gnuplot installed

- Create the directory <wordpress>/wp-content/cache, and make sure it is writable by the web server

Enjoy :)

Technorati Tags: , , ,

11,252 spam comments
blocked by
Akismet