Archive

Author Archive

Contact Form for wordpress

February 23rd, 2010 admin No comments

For a client of mine, i’ve been using the PEAR-package HTML_QuickForm which is ’superseded’ by now and isn’t compatible to php 5.2, whereas the followup package HTML_Quickform2 is still in alpha state. Since the client switched his server and that is running php 5.2, i had to come up with a new solution. I tried out many wordpress contact-form-plugins but they all did not satisfy me fully.

The only form-plugin that i truly would recommend is cForms II. It is flexible, can handle more than one form template. Forms can be inserted via template files or via tags inside posts or pages. I think this is the only plugin that supports individual Fieldsets (this can be very handy for designing complex layouts). The verification of the user input is done with very individual regular expressions. The admin can set Form field name, tooltip and default value and even let the default value be auto-cleared once the form field is activated. cForms II supports multi-page forms (which i didn’t use, though) and it can autoconfirm emails to the user (which i didn’t use either). Spam detection is done not only with the individual regular expressions, but also with a captcha-plugin or alternativey with a simple Q&A-field (like, ‘what color is snow?’). The possible questions for the Q&A field can be set manually. You can even backup and restore the form settings! Furthermore the admin can chose from a dozen css-layouts and manually change them.

Here are the other plugins, that i tried out:

  • Contact Form 7: It didn’t seem to have a template tag, that i could use in the theme files.
  • Form Builder: Very bad design. It features div-tags that are floated. If your design uses floating objects, it will break it or be broken itself!
  • Scaleable Contact Form plugin: Nearly no option to verify the user input. Supports Captcha, but it uses the plugin “simple captcha” for that, which doesn’t seem to support wordpress 2.9.
  • Spam-Free Contact Form: simply crap. don’t use that.
  • Visitor Contact: only interesting, if you like using external web applications on your own blog.
Categories: Programming, php, wordpress Tags: , ,

Scavenged pen-plotter Roland DG DXY-990

November 20th, 2009 admin No comments

Yes! I've managed to scavenge an old pen-plotter that was obviously gathering dust down in the basement of our institute. Last time i've seen such a plotter was in the 1980s at the institute where my father used to work. Back then, it was a paper-feed pen plotter that was used to plot various measured data online.

The DXY-990 plotter shown below can hold eight pen at the higher left part and moves on an xy-plane using two stepper motors which control a ribbon each. Each initialization process involves finding the lower-left corner which seems to be offset from the x-position of the pen. The plotter can be loaded with a paper size slightly bigger than DIN A3. The paper is held by a controllable static charge (wow! when did this technology disappear?) so that it doesn't move when the pen is hovering or scratching on it.

Roland DG DXY-990

The plotter has a manual dial to control it. The pen can be moved in 8 directions and two velocities. A number dial is used to change the pen. Then there are the buttons for "paper hold", "pen up/down" which simply controls a electric magnet and "pause" which can pause a loaded program. To test the plotter, one can hold the "Enter" button while turning it on (back side). It will then plot a test page.

As i expected, the control of the plotter with a pc wasn't so complicated, but finding a documentation about how to do it using standard windows/linux commands took some time. First one has to know about the HPGL-language which seems to have been a standard for plotting machines by hp which was adopted in large parts by other manufacturers. Roland DG adopted the language as RD-GL1 which is compatible to HPGL. A HPGL-command to initialize and print a line from (10,10) to (1000,1000) would look somewhat like this:

CODE:
  1. IN;SP1;PU10,10;PD1000,1000;

IN stands for "initialize". It sets back all the parameters (scaling, rotation, pen status etc..). SP stands for "select pen" and the first parameter "1" means, that the first pen should be selected. Interestingly, the dxy-990 remembers at every state, which pen it's holding and which actualy coordinates it should be at. So SP2 while holding the first pen means actually "bring back pen1, pick up pen2, go back to coordinates". To move the pen without drawing we can use the PU or "pen up" command. It takes two parameters as in x and y coordinate. I'm not quite sure about the delimetation codex. i think it's o.k. to write PU 10,10; or even P U 10,10;. To set the pen down, the command PD is used - equally with way points. PD can take as many waypoints as need be. Printing a polygon is much better using the compact notation PD1000,1000,50,50,10,40....

The easiest way to send the commands to the plotter is to write them down into a text file and then (using windows) type the following command into a shell

CODE:
  1. copy "file.hpgl" lpt1:

This is assuming the plotter is connected to the (still existing) parallel port. I didn't do serial port connection yet. The equivalent linux command should be

CODE:
  1. cat file.hpgl> /dev/lp0

With linux you can also write online commands:

CODE:
  1. cat> /dev/lp0
  2. <commands>

After each "return", the commands are sent to the plotter and it immediately performs that command.

By the way, HPGL-files can also be generated by Inkscape. The problem is that right now, the export-plugin doesn't consider changing the pen for differently colored figures and rectangles arent't exported at all. I hope this changes in the near future (maybe i will find time to work on it). I will end with a small video of the Roland DG DXY-990 plotter in action (plotting the test page). The ogg-video can be viewed with current browsers with the html5-standard and the ogg-vorbis codec implemented . Otherwise download the video and watch it offline (vlc).

Categories: CAD, Hardware, Programming Tags:

Why computers suck at maths

November 1st, 2009 admin No comments

Here is a nice article describing the problems that rise due to the methods used in nowadays computers to calculate simple mathematics. Interesting read.

iRobot explores new ways of robotic transition

October 19th, 2009 admin No comments

With the use of mechatronically controllable flexible material, the shape-shifting robot created by iRobot can actively roll around in order to get from one place to another. Interesting and long-overdue transition mode.

More about it.

Categories: Science Tags: ,

Multiscale Measurement Systems

August 12th, 2009 admin No comments


Zoom into Human Skin
von Weird_Weird_Science

Nice visualization of the use of multiscale measurement systems. Used sensors include a simple video camera, an opto-microscopic camera (maybe a confocal microscope) and i think they had to use an electronic microscope for the last steps. I like how they were able to smooth out the zoom operation accross the different scales.

More zoom-videos:

Nice Fourier poem

July 9th, 2009 admin No comments

A poem written in honor of the ever-enlightening Fourier-transform, which is often hated by students, mainly because they don't know what it means.. Here is to the Fourier-transform:

One day in a land far away
Some mathematicians at play
Found a transform of convenient form
The basis of physics today.

Convolving would wreck people's brains
Still the advent of Fourier domains
for convolving in one
means multiplication
in the corresponding domain.

Got trouble with an ODE?
Fourier transforms will set you free
When once you would cry,
You now multiply,
by a constant times the frequency.

Fourier transforms backwards and forth
I hope that you now see their worth
For in every domain
Advantages reign
Fourier was the salt of the earth.

by Luke Krieg
Posted to sci.physics, 11 Sep 2000

Thanks to Amara Graps (i was reading on wavelets..).

Creating Gray-Code sequences using gimp

June 15th, 2009 admin No comments

I needed to implement gray-code sequences for a fringe projection system i'm trying to build. To avoid hard to understand and not really intuitive C-code, i used gimp to produce the projection images. In this article i'm going to document the code used.

First is the script-fu function to generate a picture with a given number of fringes or - alternatively - a given width of the period:

CODE:
  1. (define (script-fu-oan-create-fringes fwidth t fcount)
  2. (let*
  3.     (
  4.     (myimg (aref (cadr (gimp-image-list)) 0))
  5.     (mylayer (gimp-image-active-drawable myimg))
  6.     (layers (gimp-image-get-layers  myimg))
  7.     (channels (gimp-image-get-channels myimg))
  8.     (height (car (gimp-drawable-height (car mylayer))))
  9.     )
  10.     (if (= t TRUE) (set! fwidth (/ (car (gimp-drawable-width (car mylayer))) (* anzahl 2)))
  11.                     (set! fcount (/ (car (gimp-drawable-width (car mylayer))) (* breite 2)))
  12.     )
  13.     (define i 0)
  14.     (gimp-selection-all myimg)
  15.     (gimp-edit-clear (car mylayer))
  16.     (gimp-selection-none myimg)
  17.     (while
  18.         (<i fcount)
  19.         (gimp-rect-select myimg (* (* fwidth i) 2) 0 fwidth height CHANNEL-OP-ADD FALSE 0)
  20.         (set! i (+ i 1))
  21.     )
  22.     (gimp-edit-bucket-fill (car mylayer) FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  23. )
  24. )

Then there is the register-function call to enable the menu item for the function:

CODE:
  1. (script-fu-register
  2. "script-fu-oan-create-fringes"                              ;func name
  3. "Create Fringes"                                            ;menu label
  4. "Create an image of fringes\
  5.  "                                                          ;description
  6. "Omar Abo-Namous"                                           ;author
  7. "copyright 2009, Omar Abo-Namous"                           ;copyright notice
  8. "March 02, 2009"                                            ;date created
  9. ""                                                          ;image type that the script works on
  10. SF-VALUE "Fringe width:" "16"                               ;
  11. SF-TOGGLE "Use Fringe count" FALSE                  ;
  12. SF-VALUE "Fringe count:" "8"                            ;
  13. )
  14. (script-fu-menu-register "script-fu-oan-create-fringes" "<Image>/Xtns")

An older in-depth script-fu article by me.

3DMagix: Just Blender renamed

June 11th, 2009 admin 3 comments

Apparently some silly guy is trying to make fast money by selling the open source and free 3D-software package Blender. He's using the name 3DMagix, which is a pretty dumb name. The site doesn't look to reassuring to me, but there are lots of people (some i am ashamed to call 'close relatives') who would gladly fall for this kind of 'best deal' offers. So, be warned: If you want to check out some nice and really(!) free 3d modelling, animation, texturing and video editing software (and yet some), head over to Blender.org and download it for free without having to register or give out your credit card number.. Thanks to Blendernation for the heads-up.

Here are some screen captures of the site (perhaps the creator wants to sue me?

Categories: software Tags: ,

Working bridge on startup for Virtualbox

May 24th, 2009 admin No comments

I'm experimenting with a server running under virtualbox on my home computer. Here is the script running as /etc/rc.local that sets my bridge up and starts the virtualbox with the name 'seville':

BASH:
  1. ifconfig eth0 down
  2. ifconfig eth1 down
  3.  
  4. tunctl -u namous -t tap0
  5.  
  6. brctl addbr br0
  7. brctl addif br0 eth1
  8. brctl addif br0 tap0
  9.  
  10. ifconfig tap0 0.0.0.0 promisc
  11. ifconfig eth1 0.0.0.0 promisc
  12.  
  13. dhclient br0
  14.  
  15. vboxheadless -s seville &
  16.  
  17. exit 0

Categories: software Tags:

Wordpress 2.8 announced and installed

May 18th, 2009 admin 1 comment

The Wordpress version running on this blog is now "2.8-beta1-11380". After the first beta has been announced, i switched the svn installation to trunk again (after having it to branches/2.7) and updated the blog.

There is a problem with gengo though: Right after upgrading i got this warning:

CODE:
  1. Warning: Invalid argument supplied for foreach() in /.../wp-includes/classes.php on line 255

The line in question looks like this:

PHP:
  1. foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t)

I really didn't have the time to get into this, so in order to get the blog going, i used the workaround suggested here and changed the line to:

PHP:
  1. foreach ((array) $GLOBALS['wp_taxonomies'] as $taxonomy => $t)

Categories: Programming, php, wordpress Tags: