Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

Parallels makes a virtual PC type of software for the Mac which allows you to run Windows on the Mac. Great software, but the company has a little bit of a history of quality control problems. Today the company launched a new design of their website. Unfortunately the company forgot about supporting the default Mac browser, Safari!

Parallels website shows a dropdown in the wrong place in Safari.

Nothing big: a drop down menu is showing out of place. The site actually seems to start working after you resize it for the first time, or click a single link. It’s likely to be fixed by the time many people read this, but it’s still a little bit ironic that a company with a major Mac market would not check their site in Safari.

Author: Tags: , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Jul
13.

This guide is for the programmer who needs to write a quick and dirty PHP extension. A PHP extension is a module for PHP written in C. You may wish to write such a module to expose library functionality only available in C, or to optimize certain key sections in your execution path.

As I have done before, I will attempt to make a terse summary. I assume you have or confidently can acquire knowledge of PHP and C. I’m a big fan of simple cookbook ‘recipe’ like guides, so here we go. Hold on to your hat.

Step 1: Compile PHP With Debugging Enabled

When developing your own module, you’ll want to enable debugging in PHP. This will generate error messages which may contain additional information beyond an unhelpful ‘segmentation fault’ when your module crashes.

In FreeBSD, just go into your ports, and do make config. Turn on the ‘debugging’ option and recompile PHP and its modules. Other platforms are similar; if you’re compiling from source by hand, take a look at the output of ./configure --help and you’ll find the right option for your version.

Before you start working on your module, make sure everything is in order with your server and that your extensions.ini file looks good. In my experience, rebuilding PHP under FreeBSD sometimes causes modules to appear twice in the extensions.ini file, and you may wish to be wary of this.

Step 2: Set up a project skeleton

PHP comes with great support for developing your module. There are a couple of scripts and configure related tools that automate almost all the work for you.

First, create a config.m4 file in your new project. (There’s even a tool that does this for you – ext_skel – but we’ll do it by hand for the purposes of this guide.) Here’s a bare bones config.m4 file for an extension named “pwwext”:

dnl config.m4 for extension pww

PHP_ARG_ENABLE(pwwext, whether to enable pww support,
[  --enable-pwwext          Enable pww support])

if test "$PHP_PWWEXT" != "no"; then
  PHP_NEW_EXTENSION(pwwext, pwwext.c, $ext_shared)
fi

You’ll also need some source code. Lets begin with the header file, which we’ll call pwwext.h. Lets write a minimal header:


#ifndef PHP_PWWEXT_H
#define PHP_PWWEXT_H

#define PHP_PWWEXT_EXTNAME  "pwwext"
#define PHP_PWWEXT_EXTVER   "0.1"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"

extern zend_module_entry pwwext_module_entry;
#define phpext_pwwext_ptr &pwwext_module_entry

#endif /* PHP_PWWEXT_H */

In my experience, it’s often a waste of time to learn things before you need them. This is a good example of that: the header code does pretty much what it appears to do, and more in depth knowledge is not strictly needed. In short it exposes the entry point of the module and brings in the most important header files.

Step 3: The Actual Source

Finally, we’ll need the file we referred to in config.m4 previously. It’s the main source file, pwwext.c:

/*
 * This extension enables cool pww functionality.
 */

#include "pwwext.h"

PHP_FUNCTION(pwwext_calculate)
{
  long a, b;
  
  /* Get some params. */
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
      "ll", &a, &b) == FAILURE) {
    RETURN_NULL();
  }

  if (a < = 0) {
    zend_throw_exception(zend_exception_get_default(), 
      "First argument can't be negative nor zero.", 
      0 TSRMLS_CC);
    RETURN_NULL();    
  }

  /* 
  PHP preallocates space for return values, so
  its important to use these return macros.
  */
  RETVAL_LONG(a+b);  
  return;
}

static function_entry php_pwwext_functions[] = {
  PHP_FE(pwwext_calculate, NULL)
  { NULL, NULL, NULL }
};

zend_module_entry pwwext_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
  STANDARD_MODULE_HEADER,
#endif
  PHP_PWWEXT_EXTNAME,
  php_pwwext_functions, /* Functions */
  NULL, /* MINIT */
  NULL, /* MSHUTDOWN */
  NULL, /* RINIT */
  NULL, /* RSHUTDOWN */
  NULL, /* MINFO */
#if ZEND_MODULE_API_NO >= 20010901
  PHP_PWWEXT_EXTVER,
#endif
  STANDARD_MODULE_PROPERTIES
};

#ifdef COMPILE_DL_PWWEXT
ZEND_GET_MODULE(pwwext)
#endif

There are a couple of important structures here. The variable php_pwwext_functions lists all the functions we wish to expose from the module. In our example, we’re only exporting a single function.

Then we have the pwwext_module_entry structure which truly is the entry point into your module. If you would look near the sixth line in the structure you’d see a pointer to our list of functions, for instance.

Step 4: Compiling and Running

Finally, we’ll want to build the actual module. The command phpize will get everything in order for a compilation based on your configuration. After phpize is done, the normal configure make dance is all we need. Make note of the ‘--enable-pwwext‘ argument to configure.

  1. [~/pwwext]$ phpize
  2. ./configure --enable-pwwext
  3. make

That’s all there is to it. Your module should now be built and almost ready to go. To wrap up, you’ll need to install the module in your PHP extensions folder. If you don’t know it already, run php -i to find the right folder. For me, the result is,

$ php -i|grep extension_dir
extension_dir => /usr/local/lib/php/20060613-debug => 
/usr/local/lib/php/20060613-debug

so I’ll go ahead and copy the module into /usr/local/lib/php/20060613-debug:

# cp modules/pwwext.so /usr/local/lib/php/20060613-debug/

There’s one last step we’ll have to do. We need to add the module to the list of extensions in your php.ini or extensions.ini file. Locate the section with multiple lines beginning with extension=... and add your own line. For me, this line would do it:

extension=pwwext.so

Step 5: Does it work?

Finally, we can test our new module. Run,

$ php -m

and make sure your new module is in the list.

If all is well you should be able to use your new function from any PHP script. For me, this was the final result:

$php -r'echo pwwext_calculate(1, 2);'
3
$ php -r'echo pwwext_calculate(-1, 2);'

Fatal error: Uncaught exception 'Exception' with 
message 'First argument can't be negative.' in 
Command line code:1
Stack trace:
#0 Command line code(1): pwwext_calculate(-1, 2)
#1 {main}
  thrown in Command line code on line 1

Now you have a bare bones module that does something. All that remains now is to change that one function to do something useful and you’re well on your way.

You’ll undoubtedly need more reference material going forward. Php.net is the logical starting point: The Zend API. If that’s not enough, Sara Golemon wrote a whole book about the subject: ‘Extending and Embedding PHP’.

Good luck, and don’t forget to turn off PHP debugging when you’re done.

Author: Tags: , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

Writing a business plan is an important step in founding your business. Not only is it a required part if you’re going to raise capital, but it’s also very useful since it forces you to research your competitors and the environment you will operate in. As you may or may not know, the by far most important part of you business plan is the Executive Summary. Document

Recently I attended a seminar about executive summaries, delivered by Steve Foster, Partner at Texas Pacific Group Ventures with long experience from the VC industry. The focus of the seminar was executive summaries, but Foster also shared an insider’s view on what VCs actually value when they chose what company to invest in.

Most people with some business experience have some idea of what goes into an executive summary. Although the information that goes into the executive summary might slightly differ between industries, the main objective is always to summarize your business idea in such way that an investor will be enticed to invest in your company.

So how long is an executive summary supposed to be? Traditionally most people say that it’s supposed to be about one page. According to Foster, he would rather see a three to four pages long executive summary, since it’s too hard to summarize all the information in a single page.

How do you get a VC to choose your company over the rest in the huge pile they’re reading through? Well, let’s face it, it’s very unlikely that an investor will get through even your executive summary and much less the rest of your business plan. If you fail to grab the attention of the person reading the executive summary within the first five seconds, it’s quite likely that he or she will stop right there and move on to the next project. One of the more interesting ideas that Foster suggested was to not to play by the rules. Imagine if you were personally going through maybe hundred executive summaries per day: it’d become quite boring with the typical layout and design. Therefore, it’s crucial to find ways to stand out from the crowd. Here it’s more important to use your imagination than what’s considered standard. Don’t only use blocks of text, but rather combine it with quotes, graphs, tables, bullet points and so on.

Now let’s just assume that you managed to get a person at the VC firm to read through your executive summary. When they read through your executive summary, there are a couple of things that they will look for:

References

Who referred you? This is the single most important element. If you have a personal recommendation from someone within the VC’s network, you’re far more likely to be considered than if you just cold call.

Don’t e-mail

We in the tech industry have a tendency to do all kind of communication through e-mail. However, when it comes to sending your executive summary, this is simply a big no no. You’re up to tough competition, and the fact that it takes more energy to open up an attached document than it is to briefly skim over a piece of paper plays an important role here.

Is there a market?

Is there a significant market for your product or service?

Is there room for a VC-backed venture in the market?

This relates to the previous point, and relates to the size of the market. Is the market really large enough to hold a VC backed company?

Is there urgency?

What is the team composition?

According to the presenter, the optimal team composition in the tech industry consists of one programming/tech genius and one business person who knows how to apply the technology to the market.

Ok, so now you know what to include in your executive summary and how to increase your odds of being selected. Next you might wonder if there’s any good or bad time to submit your executive summary to a VC firm. The answer is yes. Generally you should try to avoid the summer, since many VCs are out of town. Also try to avoid submitting before a major holiday. Conversely, it’s a plus if you get your executive summary read the day after major holidays, since people tend to be in a better mood then. Another time to target is January, since that’s when people come back from their long Christmas break with more energy than when they left.

This was part one in the series “Raising Capital.” In the next part we will dive deeper in how to write your actual business plan. Stay tuned…

Author: Tags: ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Jun
25.

If you’re in the initial phases of setting up a new software project, one of the first things you should be thinking about is a project collaboration site. A good project site enables you to do at least two things:

  • Collect design documents and documentation in one place
  • Track and assign tasks/bugs/issues to developers

If used correctly, the project site can become a focal point for everyone working on a particular project. Ideas, research and design documents can all be collected in one place and collaborated over. At the same time the site is a management tool enabling assignment and tracking of tasks to a team of workers. This is surprisingly important even for small teams: if your project is a two man thing, there is still great benefit to knowing what the other person is working on and being able to see his or her progress.

A simple solution for your project site is to pick different kinds of software for different tasks. For example, you may choose to use Eventum for bug and issue tracking, with a separate MediaWiki installation set up for the documentation and design collaboration. But wouldn’t it be better to combine all of this functionality into a single piece of software?

Trac is one such piece of software. It gives you issue tracking, complete with SVN integration and wiki functionality, built into a single application. An added bonus of having everything in a single application is that you can make linked references to tickets, milestones and wiki entries pretty much anywhere you want within the application.

A Trac changeset referencing a ticket.
This changeset references ticket #3.

You also get a timeline which concisely summarizes what’s happening within the project, be it wiki edits or source code commits. This can be a very popular feature for project developers – it gives everyone a chance to see what’s happening in the project, and also to get a feeling for the ‘aliveness’ of the project.

A Trac timeline showing commit messages and wiki edits.
Timeline showing both edits, source code commits and ticket updates.

Installing Trac

Here’s Playing With Wire’s accelerated setup guide for Trac.

  1. Install the basic trac package using your preferred method (ports, emerge, rpms etc).
  2. Create a new folder for the trac website on your server.

    cd /www/
    mkdir mytrac

  3. Use trac-admin to create the instance:

    cd /www/mytrac
    trac-admin `pwd` initenv

  4. Answer the questions asked by trac-admin.
  5. Once the questions have been answered, trac will give you some instructions similiar to what’s below:

    Project environment for ‘MyProject’ created.

    You may now configure the environment by editing the file:

    /www/mytrac/conf/trac.ini

    If you’d like to take this new project environment for a test drive, try running the Trac standalone web server `tracd`:

    tracd –port 8000 /www/mytrac

    Then point your browser to http://localhost:8000/mytrac. There you can also browse the documentation for your installed version of Trac, including information on further setup (such as deploying Trac to a real web server).

    The latest documentation can also always be found on the project website:

    http://trac.edgewall.org/

  6. If you use SQLite, give +rw permissions to www for the database:

    chown -R :www db
    chmod -R g+rwX db

  7. If you need to install new graphics, e.g. a new logo file you will want to copy it into the actual htdocs folder: /usr/local/share/trac/htdocs

Httpd Setup

How to configure your web server depends on both what server you’re running and what method you want to use for serving trac (cgi, fast cgi or mod python). If you’re going to run trac using CGI, you’ll basically want to link to the main trac cgi file, and also set up serving of the supporting html documents. Here’s a sample config file for how it may look like with using Apache and CGI:

Alias /trac/chrome/common /usr/local/share/trac/htdocs
<Directory “/usr/local/share/trac/htdocs”>
Order allow,deny
Allow from all
</Directory>

ScriptAlias /trac /usr/local/share/trac/cgi-bin/trac.cgi
<Location “/trac”>
SetEnv TRAC_ENV “/www/mytrac”

AuthType Basic
AuthName “WireLoad Protected Area”
AuthUserFile /www/mytrac/.htpasswd
Require valid-user
</Location>
<Directory /usr/local/share/trac/cgi-bin>
Options -Indexes +ExecCGI
AllowOverride None
Allow from all

AuthType Basic
AuthName “WireLoad Protected Area”
AuthUserFile /www/mytrac/.htpasswd
Require valid-user
</Directory>

This is fairly straight forward. The most imporant part is,

ScriptAlias /trac /usr/local/share/trac/cgi-bin/trac.cgi

which sets up trac as a cgi script accessible by going to the /trac address of the webhost.

For performance reasons, we don’t want the CGI script to serve every trac file. The following alias will override the /trac URL for the theme related files:

Alias /trac/chrome/common /usr/local/share/trac/htdocs

This has to go before the ScriptAlias line.

User Accounts

Trac’s login scheme is based on basic http authentication, which is why we added a the AuthType sections in the config file above. In fact, to log in to trac you simply authenticate with the web server using a user name and password from the .htaccess file.

Every user you define in the .htaccess file (using htpasswd) will be able to log in with some basic permissions. To configure the permissions more precisely, use the trac-admin command. For instance, to make the user with login ‘aljungberg’ an admin:

cd /www/mytrac
trac-admin `pwd` permission add aljungberg admin
trac-admin `pwd` permission add admin TRAC_ADMIN

This assigns the user ‘aljungberg’ to an admin group and gives the admin group the TRAC_ADMIN permission set.

Notice that everyone who logs in gets the ‘authenticated’ group permissions which are by default pretty useful. You can find what they are by running this command:

trac-admin `pwd` permission list authenticated

It’ll say something like:

User Action
——————————
authenticated BROWSER_VIEW
authenticated CHANGESET_VIEW
authenticated FILE_VIEW
authenticated LOG_VIEW
authenticated MILESTONE_VIEW
authenticated REPORT_SQL_VIEW
authenticated REPORT_VIEW
authenticated ROADMAP_VIEW
authenticated SEARCH_VIEW
authenticated TICKET_APPEND
authenticated TICKET_CHGPROP
authenticated TICKET_CREATE
authenticated TICKET_MODIFY
authenticated TICKET_VIEW
authenticated TIMELINE_VIEW
authenticated WIKI_CREATE
authenticated WIKI_MODIFY
authenticated WIKI_VIEW

Available actions:
BROWSER_VIEW, CHANGESET_VIEW, CONFIG_VIEW, FILE_VIEW, LOG_VIEW, MILESTONE_ADMIN, MILESTONE_CREATE, MILESTONE_DELETE, MILESTONE_MODIFY, MILESTONE_VIEW, REPORT_ADMIN, REPORT_CREATE, REPORT_DELETE, REPORT_MODIFY, REPORT_SQL_VIEW, REPORT_VIEW, ROADMAP_ADMIN, ROADMAP_VIEW, SEARCH_VIEW, TICKET_ADMIN, TICKET_APPEND, TICKET_CHGPROP, TICKET_CREATE, TICKET_MODIFY, TICKET_VIEW, TIMELINE_VIEW, TRAC_ADMIN, WIKI_ADMIN, WIKI_CREATE, WIKI_DELETE, WIKI_MODIFY, WIKI_VIEW

To find out which permissions are available, check out the TracPermissions documentation page.

Setting up the SVN hook

To allow SVN commits to close tickets using cool syntax like ‘Fixes #1′ in commit messages, an SVN hook has to be installed. Hook scripts in SVN are described in the SVN documentation.

Enter a post-commit script in the hooks/ folder of your SVN repository:

REPOS=”$1″
REV=”$2″
LOG=`/usr/local/bin/svnlook log -r $REV $REPOS`
AUTHOR=`/usr/local/bin/svnlook author -r $REV $REPOS`

TRAC_ENV=’/www/mytrac/’
TRAC_URL=’http://mytrac.wireload.net/trac/’

/usr/local/bin/python /www/mytrac/trac-post-commit-hook \
-p “$TRAC_ENV” \
-r “$REV” \
-u “$AUTHOR” \
-m “$LOG” \
-s “$TRAC_URL”

You may have to download the actual script from the repository. Make sure you get the right version. I initially accidentally got the latest version since I grabbed it from the SVN, and it wasn’t compatible with trac 0.10.3 which I had installed.

Finally make sure the script can be run,

chmod a+rx post-commit
chmod a+x /www/mytrac/trac-post-commit-hook

The users who run the script must also be able to read and write to the trac database. You can make sure this works by test submitting some change set for analysis:

su -m wlaljungberg post-commit /home/mysvn/myproject/ 4

If the database isn’t accessible you’ll get an error message similar to this one:

trac.core.TracError: The user root requires read _and_ write permission to the database file /www/mytrac/db/trac.db and the directory it is located in.

The hook is nice. Here’s a description of what it does, quoted from the actual script:

# It searches commit messages for text in the form of:
# command #1
# command #1, #2
# command #1 & #2
# command #1 and #2
#
# You can have more then one command in a message. The following commands
# are supported. There is more then one spelling for each command, to make
# this as user-friendly as possible.
#
# closes, fixes
# The specified issue numbers are closed with the contents of this
# commit message being added to it.
# references, refs, addresses, re
# The specified issue numbers are left in their current status, but
# the contents of this commit message are added to their notes.
# A fairly complicated example of what you can do is with a commit message
# of:
#
# Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.
#
# This will close #10 and #12, and add a note to #12.

If you run into any trouble, take a look at the excellent Trac documentation. Good luck with your new project!

Author: Tags: ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Jun
21.

A while back we wrote an article called What’s Your Utilization, Kenneth. In that article we talked about a really cool web-app called Cacti. Today we will take this one step further by describing how to monitor remote servers using SSH tunnels.

In the scope of this article, we assume that you already have one Linux or Unix server configured with Cacti running. Moreover, we also assume that you have another remote server that you want to monitor (why else would you read this article?).

First we start by setting up the remote server. The first thing we need to do is to set up Net-SNMP. If you’re running FreeBSD, chances are that you already have this installed. If so, all you need to do is to change your community string and set up the daemon to bind on port 161/tcp instead of 161/udp. To do this, change/add the following lines in your snmpd.conf (/usr/local/share/snmp/snmpd.conf in FreeBSD):

com2sec local localhost public
agentaddress tcp:161

Once this is done, go on and restart the daemon.

To test that the SNMP daemon is working properly, try to run the following command:

# snmpwalk -v 1 -c public tcp:localhost:161

If your screen gets flooded with information, it worked. If not, please look over your log-files to find out what went wrong.

Next we need to create a secure user which we will be able to use to login from the Cacti-machine onto the remote machine. To maximize security, we suggest that that user has ‘nologin’ as shell and uses public key authentication instead of password. However, we will not cover how to create this user in this guide. Ask Google for help if you need it.

Repeat this for all hosts you want to remotely monitor.

That’s it for the remote server, now let’s move on to the Cacti host.

First we want to create a script that sets up the tunnel to the remote server. We suggest that you create a new user that will be running these tunnels (i.e. snmp). In order to make it easier to manage the tunnel (or tunnels if you have several hosts), we will create a bash-script that initializes the tunnel(s). In the home directory of the the user you created, create a file called tunnels.sh with the following contents:

#!/bin/sh
rm /home/snmp/tunnel.log

# server1.xyz.net
ssh -N -L 16000:127.0.0.1:161 [email protected] >> /home/snmp/tunnel.log &

# server2.xyz.net
ssh -N -L 16001:127.0.0.1:161 [email protected] >> /home/snmp/tunnel.log &

Note that this initalize two tunnels, one to server 1 (on port 16000) and one to server 2 (on port 16001. Also, don’t forget to chmod the file so that you can execute it, by typing chmod +x tunnels.sh.

Next we want to start up the tunnels using the snmp-user we created earlier. To do this run:

#sudo -u snmp /home/snmp/tunnels.sh

If everything went fine, you should now have two tunnels running; one on port 16000 and one on port 16001. Now let’s test the tunnels before we move on to Cacti.

# snmpwalk -v 1 -c public tcp:localhost:16000
# snmpwalk -v 1 -c public tcp:localhost:16001

This should hopefully give you the the same output as you previously received when executing snmpwalk locally on the remote hosts. If this went well, all you need to do now is to add the hosts to Cacti.

First you need to log into Cacti with an administrative account. Then got to “Create Device.” In the Create Device field, as shown in the screenshot bellow.
Create Device

Description: server1.xyz.net
Hostname: tcp:127.0.0.1
Host Template: ucd/net SNMP Host
SNMP Community: public
SNMP Version: Version 1
SNMP Port: 16000

After you’ve filled out the proper data, hit ‘Create.’ At the next page, just select the data you want to graph, and then hit ‘Next.’

That should be all you need to graph remote hosts. Now you may want to go ahead and add the host to a tree so that you can display it in the ‘Graph’ tab.

Author: Tags: ,

© 2006-2009 WireLoad, LLC.
Logo photo by William Picard. Theme based on BlueMod © 2005 - 2009 FrederikM.de, based on blueblog_DE by Oliver Wunder.
Sitemap