Thursday, March 26, 2009

how to sha1 checksum a file in os x using openssl

openssl dgst -sha1 filenamegoeshere

Wednesday, March 25, 2009

thoughts on an agile-waterfall mixed process

I don't often talk about the business behind software engineering but recently I have had to talk process a lot more with other stakeholders in projects and below is a summary of what I have started to formalize as a agile-waterfall combination process. Though I agree that a fully agile software devleopment process like scrum, XP etc is probably better and more efficient, it is a hard sell for some clients who are so used to the traditional waterfall process. It is also hard to tell some execs in a client services company to let go of their need to have client "sign-off" on everything. Anyways here is a first stab:

requirements gathering / exploration
requirements document
client priority analysis
functional specifications
effort analysis of line items in functional spec
prototype risky functionality
mood boards for design
content and functionality document (with summarized effort based on knowledge from effort analysis of functional spec and client priority analysis)
(at this point we should know what the client wants for the initial launch of the product based on effort and priority. Things that are too costly and low priority should be put off until post launch)
wireframes
user testing of wireframes (not required)
annotated wireframes with func spec / inform wireframes from func spec and vice versa
design round based on wireframes
user testing of design (not required)
scaffold functionality based on wireframes (this task might be broken into a dozen or more scrum sprints depending on the size of the project)
content entry
user testing of scaffolding (not required)
design round
further user testing of design (not required)
sign off of design
build out full functionality to work with design (again this task might be broken into a dozen or more scrum sprints depending on the size of the project)
content entry
QA
Bug fixes
product launch
post launch feature requirements review and exploration (begin process over again)

Tuesday, March 24, 2009

more bash wildcard craziness

Now, what happens if you specify a pattern that doesn't match any file system objects? In the following example, we try to list all the files in /usr/bin that begin with asdf and end with jkl, including potentially the file asdfjkl:

Code Listing 5.5: Another example of the * glob

$ ls -d /usr/bin/asdf*jkl ls: /usr/bin/asdf*jkl: No such file or directory 

Here's what happened. Normally, when we specify a pattern, that pattern matches one or more files on the underlying file system, and bash replaces the pattern with a space-separated list of all matching objects. However, when the pattern doesn't produce any matches, bash leaves the argument, wild cards and all, as-is. So, then ls can't find the file /usr/bin/asdf*jkl and it gives us an error. The operative rule here is that glob patterns are expanded only if they match objects in the file system. Otherwise they remain as is and are passed literally to the program you're calling.



Wild card syntax: []

This wild card is like a ?, but it allows more specificity. To use this wild card, place any characters you'd like to match inside the []. The resultant expression will match a single occurrence of any of these characters. You can also use - to specify a range, and even combine ranges. Examples:

myfile[12] will match myfile1 and myfile2. The wild card will be expanded as long as at least one of these files exists in the current directory.
[Cc]hange[Ll]og will match Changelog, ChangeLog, changeLog, and changelog. As you can see, using bracket wild cards can be useful for matching variations in capitalization.
ls /etc/[0-9]* will list all files in /etc that begin with a number.
ls /tmp/[A-Za-z]* will list all files in /tmp that begin with an upper or lower-case letter.
The [!] construct is similar to the [] construct, except rather than matching any characters inside the brackets, it'll match any character, as long as it is not listed between the [! and ]. Example:

rm myfile[!9] will remove all files named myfile plus a single character, except for myfile9

? matches any single character. Examples:

  • myfile? matches any file whose name consists of myfile followed by a single character
  • /tmp/notes?txt would match both /tmp/notes.txt and /tmp/notes_txt, if they exist

More fun linux tidbits

I don't remember this wildcard syntax ever.

To solve this problem, you can take advantage of Linux' built-in wild card support. This support, also called "globbing" (for historical reasons), allows you to specify multiple files at once by using a wildcat pattern. Bash and other Linux commands will interpret this pattern by looking on disk and finding any files that match it. So, if you had files file1 through file8 in the current working directory, you could remove these files by typing:

Code Listing 5.2: Removing files using shell completion

$ rm file[1-8]

saving your rm -rf ass

If you are still getting used to the rm command, it can be useful to add the following line to your ~/.bashrc file using your favorite text editor, and then log out and log back in. Then, any time you type rm, the bash shell will convert it automatically to an rm -i command. That way, rm will always work in interactive mode:

Code Listing 4.12: Setting the 'rm -i' alias

alias rm="rm -i"

sending email from php on leopard server 10.5.6

The default installation of leopard server comes with postfix and a sendmail wrapper for postfix that you can use to send email from php. You have to jump through a few hoops to get it to work though.

First you must make sure that you have apache and php installed correctly. you can verify this by creating a phpinfo.php file with contents and then viewing it at your servers ip address (or domain name) in your client computers web browser. If the phpinfo.php renders correctly then you can move on to the next steps: (taken from: http://jspr.tndy.me/2008/05/php-mail-and-osx-leopard/)


There are 4 files I used for the following:
  • /etc/hostconfig
  • /etc/postfix/main.cf
  • php.ini (this could be anywhere depending on your installation, mine’s in /usr/local/php5/lib/)
  • /var/log/mail.log

firstly, sudo nano -w /etc/hostconfig and add the following line:

MAILSERVER=-YES-

then sudo nano -w /etc/postfix/main.cf, find the myhostname variable (by default it’s host.domain.tld), uncomment it and change it to your domain (if you’re on a machine that doesn’t have a DNS, you can make it a domain that you’re responsible for so that it doesn’t get shut down at the receiving end, but please don’t make it google.com or something like that!)

now, open php.ini and look for the sendmail_path variable, uncomment it, make its value sendmail -t -i, save then restart apache. I’m not really sure if this is 100% necessary as there’s a comment above that says this is the default value anyway, but it can’t hurt!

now open a terminal window and execute the next couple of commands:



My machine already had postfix running for some reason. That might have been because I had been playing with sendmail for the hour or so before I found the tutorial above. For that reason I had to "restart sendmail" in order to get it to read in the new main.cf configuration. So I did the following:

sudo postfix reload

however that made sendmail report the following error:
postfix/postfix-script: warning: not set-gid or not owner+group+world executable: /usr/sbin/postdrop

SO after a quick google search I found that this can be fixed by performing the following command:
chmod g+s /usr/sbin/postdrop

Then you can:
sudo postfix stop
sudo postfix start

and then for good measure restart apache:
sudo apachectl restart

Finally double check its all working by finishing the tutorial:


% sudo postfix start
% tail -f /var/log/mail.log

finally, create a file called mail.php (or whatever!) and add the following to it:

mail(
'you@yourdomain.com', // your email address
'Test', // email subject
'This is an email', // email body
"From: Me rn" // additional headers
);


?>
obviously replace you@yourdomain.com with your email address and me@mydomain.com with a valid email address (domain at least, as some mail servers will bounce your email if the sender’s domain isn’t real). Now navigate to your mail.php file (likely http://localhost/mail.php) and watch your terminal window to see that it’s been sent successfully.

Thursday, March 5, 2009

Using Yum (common yum tasks)

To update system. Update of the system with all the dependencies that are necessary:
Code:
yum update
Searches. To make a search of some package or term in the data base in some of the formed deposits yum in the system:
Code:
 yum search any-package
Example:
Code:
yum search httpd
I hope this will help you understand how to use yum more effeciently. Any erros in this how please notify me.
Consultation of information. To consult the information contained in a package in individual:
Code:
 yum info any-package
Example:
Code:
yum info httpd
Installation of packages. Installation of paquetería with automatic resolution of dependencies:
Code:
 yum install any-package
Example.
Code:
yum install gkrellm
Uninstalling packages. Desinstalación of packages along with everything what it depends on these:
Code:
yum remove any-package
Example.
Code:
yum remove gkrellm
Listing Packages. The following thing will list all the packages available in the data base yum and that can settle:
Code:
 available yum list|less
The following thing will list all the packages installed in the system:
Code:
 yum list installed|less
The following thing will list all the packages installed in the system and that can (they must) be updated:
Code:
 yum list updates|less
Cleaning of the system.

Yum leaves as result of its use heads and packages RPM stored in the interior of the directory located in the route /var/cache/yum/. Particularly the packages RPM that have settled can occupy much space and is by such reason agrees to eliminate them once no longer they have utility. Also it agrees to do the same with the old heads of packages that no longer are in the data base. In order to make the corresponding cleaning, the following thing can be executed:
Code:
 yum clean all
Group install
Code:
yum groupinstall "groupname"
Dont forget the quotation marks for group install.

I hope this will help you understand how to use yum more effeciently. I did this for our newbies that may want to uninstall packages which is not mention in the fedora FAQ. For more info on yum go here: http://www.fedorafaq.org/#installsoftware


MORE:

One tip, you can use also joker-signs as * or ? e.g.
Code:
yum install gkrellm*
will install gkrellm, gkrellm-plugins, gkrellm-misc-plugins etc.

And to install/remove you have to be root! Not for searching.

To search in package names only, use yum list. This differs from search in that it's much faster, as it will search package names only, while yum search will search all the package info, including package description.
Code:
yum list something
Example
Code:
yum list mozilla
To get the name of the package containing a given file:
Code:
yum provides filename
example:
Code:
yum provides /usr/bin/mozilla
Here's some new goodies in yum 2.2 (Fedora Core 3 and beyond)

To get a list of packages updated/added to any of your repositories recently:
Code:
yum list recent
To enable a repository which is disabled in the configuration:
Code:
yum --enablerepo=reponame install packagename
example
Code:
yum --enablerepo=dag install j2re
To list available software groups, such as GNOME desktop environment or X window system. This is also available in the Core 2 yum, but servers doesn't use this wonderful feature much.
Code:
yum grouplist
To install such a group:
Code:
yum groupinstall "groupname"
Example:
Code:
yum groupinstall "GNOME Desktop Environment"
And to update a group
Code:
yum groupupdate "GNOME Desktop Environment"

And remember folks, you can always use -y to say yes to everything, and -C to use the cache only.

get the latest version of postgres (8.3) on your centos box

Centos repos are so damn old. Here is a tutorial on getting postgres 8.3 on
your box.

http://it.toolbox.com/blogs/web2-place/if-your-yum-is-not-fetching-latest-po
stgres-25582