firewing1's blog

Avicii - Levels

I can't seem to find this on Beatport or iTunes to buy :(

Rating: 
Tags: 

My thoughts on Java (part 2)

Sometimes, I feel like people give Java a bad rap. It's a language that's in demand out on the field and after using it for my school classes, I have found that it is easy to program in, it performs very well and your code is portable/cross-platform. Sounds great, right? At first glance Java magically turns everything that's hard to do into something easy.

But then I'll use Java-based software and somehow it manages to consistently be extremely complex to setup/configure (ie, tomcat+webapps), to have horrible looking UIs (ie, LimeWire, FreeNode, OpenOffice) and often it consumes lots of resources needlessly (ie, OpenOffice, LimeWire). I mean seriously, you can get a PHP or Python-enabled webserver up and running in under 2 commands on RHEL and then you just need to create a single script file to start serving pages. The Java community really needs to spend some time working on developer/user experience in my opinion.

Rating: 

Desktop cleaning

I've always cared a lot about user experience because I find that no matter how great a single piece or a collection of software is, it is the user experience that shapes your impression of that software. That said, I was cleaning up my (very, very messy) desktop and came across an old backup of a Fedora installation. There was a file on my desktop from July 2008 that I had completely forgotten about... I had collected my thoughts at the time on how Linux-based distributions could be improved to make the user experience better. It's really neat to see how many of these have been implemented in only 3 short years:

my apologies for the messy read, I tend to write my notes in Wiki format and I don't feel like copy/pasteing <li>'s all over the place ;)

* The Linux installation+boot process
  * Installers must try to recognize an existing Linux installation's boot
    configuration and add theirs to it, not overwrite the previous one.
  * Be able to partition (read: resize) other filesystems intelligently and
    efficiently.
  * Provide installation profiles. Stop fighting over what packages or
    configurations to use and realize that a server, an enterprise and the
    typical user all have different sets of expectations and needs.
  * GRUB should have an extendable plug-in system where distributions could
    plug-in modules to have it suggest which partitions to boot from (ie
    distribution auto-find)
  * Graphical bootup: X in initramfs. Ubuntu does this already, it's an excellent
    idea and gives the user a better overall experience.
   
* Standardizing the Desktop
  * User accounts
    * Unix names are confusing to users. Have the system map metanames to Unix
      names so that people can login with e.g. "firewing" or "Stewart Adam"
    * Allow the administrator to create user groups and define their privileges.
      User accounts belong to one or more groups which defines what they can do.
      * User control is easy and at the same time they can be given needed
        privileges (software updates, mounting drives, etc) without having to
        know the root password.
  * Unified package management. Create a standard for both package managers and
    packaging. This enables large, cross-distro compatible repositories that
    benefit the users.

* User experience
  * Prompt the user for backups once a week. Include a don't show me again
    option.
  * Why can't we configure tapping on a per-user basis again? Right, xorg.conf.
   
* Developers
  * Need to accept and handle user feedback. Although Linux is used by a lot of
    developers, most of the users are non-developers users. It would make
    sense to prioritize what they have to say.

* Kernel
  * If a device is present but isn't supported, provide a signal so that the
    desktop environment can present a dialog explaining the problem and showing
    the user what they can do to help.
    * More specifically, reporting the device IDs and collecting common log
      files.
  * Create "FooKits" for helping monitor and solve common problems. Power usage,
    kernel oopses, SELinux, etc.
  * Reload parts of the kernel without rebooting (just improve kmem)

* Documentation
  * Don't leave users out in the cold. They shouldn't have to do a day of
    research to get the OS installed or to perform simple tasks. Provide
    tooltips and help buttons inside programs.
  * Dumbing down doesn't solve much. The best type of documentation is easy
    to understand but contains technical information at the same time.
   
* Other
  * Interfaces need to be somewhat standardized and resemble each other in
    nature. They overall goal is that programs should be intuitive -
    Documentation should accompany a program, but the interface should be
    intuitive enough that users shouldn't have to read it to get started.
  * Something nice for the help menu layout:
    - Documentation
    - Check for Updates (this would use the standardized package manager)
    - Report a bug
    - Help translate this program
    - About this program
  * Synchronize user information (ie, UID/GIDs) between various distributions.
  * There needs to be an easy communication channel between developers/
    packagers and users so that they are encouraged to help out. Testing and
    providing feedback and bug reporting and bug sorting/solving is not hard but
    goes a long way in helping the developers troubleshoot problems.

Rating: 

First part of CentOS 5 server setup howto series now available

After much research, experimentation, testing and tweaking I'm happy to announce that I have completed the first part of my CentOS 5 server setup howto series!

As of today, you'll notice a new CentOS 5 Howtos link on the where I have listed the first two parts of the howto series, the getting started howto which will help you setup a basic system environment and more importantly, the mail server howto which documents how to setup a secure mail server offering POP3/IMAP/SMTP with virtual users stored in a MySQL database.

I'm very happy with this setup because it uses virtual users that cam be mapped to system users and also keeps the software set relatively small; Dovecot is used for SASL authentication (both for POP3/IMAP and SMTP) and for postfix's local delivery agent, so with only 2 servers we've got it all covered (of course technically it's 3 servers with an extra transport if you take amavisd and response-lmtpd into account).

The virtual user database is currently only used in this tutorial for the mail server, but I have plans to introduce (with an upgrade path) a new database structure that will unify several authentication data pools and make managing clients for a shared hosting server easier... But I'll talk more about that later once I've finished posting my other guides. I plan on adding ones for other services such as DNS & Web, although I cannot promise when those will be finished. The mail server tutorial alone is 16 printed pages (!) so it does take me quite some time to ensure that the tutorial is well documented and that the configurations listed work properly.

I still have to add some notes here and there about the implementation, but the core material is there. Enjoy!

Rating: 

Ubercart modules: Manual shipping quote & payment after checkout

I have been working with a client to setup an Ubercart store customized to their needs and one of the things we came across as we launched the store is that because of the nature of the items being sold, it was very difficult to give a accurate shipping estimate. Thus, I set off to find a way to enable customer payments after checkout and to enter the shipping quotes manually.

These two modules, uc_manual_shipping and uc_payafter, are the fruit of these efforts. I hope you find them useful!

Note that this is my first release of these modules and the code should be considered a beta and work in progress. They are untested so far and not recommended for use on a production site just yet. All information about installation, configuration and further development is available in the README.txt file, DEVELOPERS.txt file and/or source code comments. If you have made some changes or improvements, please let me know in the comments! I would love to hear about your changes and I would be more than happy to apply any patches or bugfixes.

uc_manual_shipping enables the store administrators to manually enter shipping quotes on orders after a user has passed through checkout. It can be used in combination with uc_payafter to have users create go through regular checkout without paying, and then pay later once a shipping quote has been submitted by a store administrator.
Download uc_manual_shipping-6.x-1.0.tar.gz

uc_payafter duplicates the checkout process and allows users to perform payments on their orders after checkout at the URL cart/checkout/pay/$ORDER_ID. Store administrators can email users different invoice templates after payment.
Download uc_payafter-6.x-1.1.tar.gz

Update 2011-06-08: A user in the comments, Moises, has pointed out that in the 6.x-1.0 release of uc_payafter there was a typo that would prevent users from being able to select the request shipping invoices in the conditional actions configuration. I have updated uc_payafter below to fix this bug.

Update 2011-11-08: uc_payafter has a new home! I have created a Drupal Sandbox project for the code here. Once I have the chance to work on the code a bit more, I will promote it to full project status and update the download links in this post.

Rating: 

Drupal 7 playground, coming soon to a blog near you!

I'm going to be upgrading this blog to D7 soon so I can experiment a bit with a live install... Sorry if there's some (brief) unexpected downtime!

Edit 2011-02-26: It's up and running! Not the most pleasant upgrade experience, but then again I can't complain too much for a point-zero release. Most of the issues were caused by third-party modules (namely Fivestart Comment and CKEditor). Also, as a reminder to those who are using custom color styles on a Drupal theme: changes in the theme's CSS will only take effect *after* you save the theme settings to re-generate the theme CSS! I spent about 50 minutes trying to figure out why any CSS changes were not being applied until it hit me and /facepalm ensued...

Edit 2011-03-01: Just realized that the howto indexes (which use Views) were completely broken until now. Sorry about that! It's been fixed now, although the formatting (mostly page breaks) are rather broken on the howto pages themselves, I'll have to clean that up next week.

Rating: 
Tags: 

Metro

I was in the metro today and the train arrived at the stop as usual, but as it came to a complete stop the doors didn't open. The conductor was obviously trying repeatedly to open the doors because the red lights at the top of the cars kept flickering on and off (they usually stay on when the metro doors are open).

After about 2 minutes trying to get the doors open, the conductor shut down the metro train, so the air vents stopped and lights when out for a brief moment as she/he restarted the engines. It's perfectly logical that this is possible as after all, they have got to start the trains at the beginning of the day to get them moving along the metro lines but it was just bizarre to see a train in its powered down state.

The good news is whatever restarting the engines does fixed the problem - the doors opened immediately after the conductor "reset" the metro train.

Rating: 
Tags: 

Brain pattern recognition

Sometimes the brain just amazes me. On the way home a few days ago I was listening to Paul van Dyk - Complicated from his album In Between. I couldn't pinpoint it, but for some reason something about the song suddenly seemed very familiar... The best way I can describe it was like audio déja-vu. I knew that the familiarness wasn't just because I had heard the song a bunch of times before (I had, after all, bought the album).

Today I was thinking about it again but I still couldn't find out what made it seem so familiar. So I forgot about it, and then suddenly David Guetta vs The Egg - Love Don't Let Me Go got stuck in my head. Almost immediately, I realized "hey, that's the song!"

I think Paul Van Dyk has used a sample from it. Check it out:

Paul van Dyk - Complicated (In Between, 2007) -- sample appears throughout

David Guetta vs The Egg - Love Don't Let Me Go (Single, 2006) -- sample appears at 0:39

(Disclaimer: I didn't upload the videos, nor do I own the copyright. Sorry if the embeds break.)

I found it incredibly cool that just by thinking about a song, the brain can recognize a pattern and match it up with similar bits from other songs without you even consciously trying to do it.

Rating: 

Installing the Darwin Calendar Server 2.4 on Fedora 13 or Fedora 14

As I mentioned in my last post, I've been playing with the Darwin Calendar Server (DCS) on Linux... Today I was able to re-test my setup notes to see if they worked properly, so below I've written a tutorial on how to get your own DCS server going on Fedora 13 or 14.

Installing Dependencies

Since we will be installing CalendarServer directly from the 2.4 branch subversion repository, the first thing to do is to install subversion and the dependencies for DCS:

su -
# Required to check out the source code from the repository
yum install subversion
# Dependencies
yum install patch memcached krb5-devel python-zope-interface PyXML pyOpenSSL python-kerberos
# Requirements for compiling xattr
yum install python-setuptools gcc gcc-c++ python-devel

Enable extended file attributes (xattrs)

DCS requires user extended file attributes so the user_xattr mount option must be enabled for the partition on which CalendarServer will be storing its documents and data (in this case, /srv). If you have not already enabled this option (it is disabled by default), edit /etc/fstab and add the user_xattr mount option after defaults, for example:

/dev/mapper/VolGroup-lv_root /                       ext4    defaults,user_xattr        1 1

Grab DCS from SVN and run auto-setup

Once these packages have been installed and extended file attributes have been enabled, we will begin setting up the CalendarServer as your regular, non-root user.

# Directory to hold CalendarServer checkout and its dependencies
mkdir CalendarServer
cd CalendarServer
# Checkout the code from the repo
svn checkout http://svn.calendarserver.org/repository/calendarserver/CalendarServer/tags/release/CalendarServer-2.4 CalendarServer-2.4
cd CalendarServer-2.4
# Start auto-setup
./run -s

Auto-setup will now attempt to grab any missing dependencies for CalendarServer an will unpack and patch them accordingly. You may find that the download for PyDirector stalls - if so, hit to abort setup and download it manually:
pushd ..
wget http://downloads.sourceforge.net/pythondirector/pydirector-1.0.0.tar.gz
tar xfz pydirector-1.0.0.tar.gz
popd
# Resume unpacking
./run -s

Prepare for installation

Since DCS bundles a modified version of Twisted as well as a few other projects (such as pydirector), we will now prepare an installation root folder to avoid conflicts with system libraries (i.e., Twisted if it has been installed from the Fedora repos). This code will be run as root.

su -
# setup data & document roots
mkdir -p /srv/CalendarServer/{Data,Documents}
chown -R daemon:daemon /srv/CalendarServer/
# setup installation root
mkdir -p /opt/CalendarServer/etc/caldavd
mkdir -p /opt/CalendarServer/var/run/caldavd
mkdir -p /opt/CalendarServer/var/log/caldavd

Install DCS and configure the server instance

The last step is to install DCS from the Subversion checkout we made earlier into the installation root. Replace /home/regularuser with the actual path to the home directory of your regular user.

# install DCS to installation root
cd /home/regularuser/CalendarServer/CalendarServer-2.4
./run -i /opt/CalendarServer
rm -rf /opt/CalendarServer/usr/caldavd/caldavd.plist
# copy sample configuration files
cp conf/servertoserver-test.xml /opt/CalendarServer/etc/caldavd/servertoserver.xml
cp conf/auth/accounts.xml /opt/CalendarServer/etc/caldavd/accounts.xml
cp conf/caldavd-test.plist /opt/CalendarServer/etc/caldavd/caldavd.plist
cp conf/sudoers.plist /opt/CalendarServer/etc/caldavd/sudoers.plist
# change permissions; passwords are stored plaintext!
chmod 600 /opt/CalendarServer/etc/caldavd/*

I have reported bugs #390 and #391 about problems with the setup script on 64-bit machines as well as a problem if a custom destination installation directory is used (which we did). This bit of code works around both of the bugs:
# 64-bit fix - see https://trac.calendarserver.org/ticket/391
sitelib="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
sitearch="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(1))')"
if [ "$sitelib" != "$sitearch" ];then
  mv /opt/CalendarServer"${sitelib}"/twisted/plugins/caldav.py* /opt/CalendarServer"${sitearch}"/twisted/plugins
  # PYTHONPATH fix for 64-bit - see https://trac.calendarserver.org/ticket/390
  sed -i.orig 's|PYTHONPATH="'"${sitelib}"'|DESTDIR=/opt/CalendarServer\nPYTHONPATH="${DESTDIR}'"${sitelib}"':${DESTDIR}'"${sitearch}"':|' /opt/CalendarServer/usr/bin/caldavd
else
  # PYTHONPATH fix for 32-bit - see https://trac.calendarserver.org/ticket/390
  sed -i.orig 's|PYTHONPATH="'"${sitelib}"'|DESTDIR=/opt/CalendarServer\nPYTHONPATH="${DESTDIR}'"${sitelib}"':|' /opt/CalendarServer/usr/bin/caldavd
fi

If you would like your server to use SSL (highly recommended), you will need to generate a certificate. If you have a certificate and key ready to install, place it in /opt/CalendarServer/etc/tls. If not, you can easily generate a free self-signed one:

# Generate SSL keys
mkdir /opt/CalendarServer/etc/tls
openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout www.example.com.key -out www.example.com.crt

Now, edit /opt/CalendarServer/etc/caldavd/caldavd.plist in your favorite editor and configure the server as follows:
    <!-- Network host name [empty = system host name] -->
    <key>ServerHostName</key>
    <string>example.com</string> <!-- The hostname clients use when connecting -->

# Data roots
    <!-- Data root -->
    <key>DataRoot</key>
    <string>/srv/CalendarServer/Data/</string>
        
    <!-- Document root -->
    <key>DocumentRoot</key>
    <string>/srv/CalendarServer/Documents/</string>

# Test accounts configuration
    <!-- XML File Directory Service -->
    <key>DirectoryService</key>
    <dict>
      <key>type</key>
      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
         
      <key>params</key>
      <dict>
        <key>xmlFile</key>
        <string>/opt/CalendarServer/etc/caldavd/accounts.xml</string>
      </dict>
    </dict>

# Sudoers configuration
    <!-- Principals that can pose as other principals -->
    <key>SudoersFile</key>
    <string>/opt/CalendarServer/etc/caldavd/sudoers.plist</string>

# Delete this section
<!-- Wikiserver authentication (Mac OS X) -->
      <key>Wiki</key>
      <dict>
        <key>Enabled</key>
        <true/>
        <key>Cookie</key>
        <string>sessionID</string>
        <key>URL</key>
        <string>http://127.0.0.1/RPC2</string>
        <key>UserMethod</key>
        <string>userForSession</string>
        <key>WikiMethod</key>
        <string>accessLevelForUserWikiCalendar</string>
      </dict>

# logging
    <!--
        Logging
      -->

    <!-- Apache-style access log -->
    <key>AccessLogFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/access.log</string>
    <key>RotateAccessLog</key>
    <false/>

    <!-- Server activity log -->
    <key>ErrorLogFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/error.log</string>

    <!-- Log levels -->
    <key>DefaultLogLevel</key>
    <string>info</string> <!-- debug, info, warn, error -->
# a bit further down…
    <!-- Global server stats -->
    <key>GlobalStatsSocket</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd-stats.sock</string>
# <snip>
    <!-- Server statistics file -->
    <key>ServerStatsFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/stats.plist</string>
       
    <!-- Server process ID file -->
    <key>PIDFile</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd.pid</string>

# SSL 
    <!-- Public key -->
    <key>SSLCertificate</key>
    <string>/opt/CalendarServer/etc/tls/www.example.com.crt</string>
           
    <!-- Private key -->
    <key>SSLPrivateKey</key> 
    <string>/opt/CalendarServer/etc/tls/www.example.com.key</string>

# Privilege drop
    <!--
        Process management
      -->
   
    <key>UserName</key>
    <string>daemon</string>
   
    <key>GroupName</key>
    <string>daemon</string>
       
    <key>ProcessType</key>
    <string>Combined</string>

# iSchedule server-to-server settings
      <!-- iSchedule protocol options -->
      <key>iSchedule</key>
      <dict>
        <key>Enabled</key>
        <false/>
        <key>AddressPatterns</key>
        <array>
        </array>
        <key>Servers</key>
        <string>/opt/CalendarServer/etc/caldavd/servertoserver.xml</string>
      </dict>

# Communication socket
    <!-- A unix socket used for communication between the child and master processes.
         An empty value tells the server to use a tcp socket instead. -->
    <key>ControlSocket</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd.sock</string>


# Twisted
    <!--
        Twisted
      -->
        
    <key>Twisted</key>
    <dict>
      <key>twistd</key>
      <string>/opt/CalendarServer/usr/bin/twistd</string>
    </dict>

# Load balancer
    <!--
        Python Director
      -->

    <key>PythonDirector</key>
    <dict>
      <key>pydir</key>
      <string>/opt/CalendarServer/usr/bin/pydir.py</string>

      <key>ConfigFile</key>
      <string>/opt/CalendarServer/etc/pydir.xml</string>

      <key>ControlSocket</key>
      <string>/opt/CalendarServer/var/run/caldavd/caldavd-pydir.sock</string>
    </dict>

...Profit!

Try starting the server!

/opt/CalendarServer/usr/bin/caldavd -T /opt/CalendarServer/usr/bin/twistd -f /opt/CalendarServer/etc/caldavd/caldavd.plist -X

If all goes well, press to kill the process and then daemonize it:
/opt/CalendarServer/usr/bin/caldavd -T /opt/CalendarServer/usr/bin/twistd -f /opt/CalendarServer/etc/caldavd/caldavd.plist

Rating: 

Playing with the Darwin Calendar Server

Sorry for the lack of posts lately, I've been caught up with school and updating my FOSS on the side whenever I have some spare time.

The server that runs this site as well as diffingo.com and a few others is almost always idle - the load averages rarely exceed 0.5, and are most often sitting somewhere around 0.2 (it's a 1U/Core 2 Quad Q9550@2.83GHz/8GB RAM/2x1TB RAID 1). I have bigger plans for it in the future, but at the moment there just isn't a great deal for it to do since it handles everything so quickly.

I have been wanting to see how KVM VMs perform on it as well as try out the Darwin Calendar Server (DCS)... Seeing as DCS requires Python 2.5 and I didn't want to mess around with the live server's configuration (CentOS 5.x ships with Python 2.4), I installed Fedora 13 in a virtual machine so I could test the calendar server safely.

To my surprise, KVM works really, really well... I wasn't expecting that seeing as the versions I had used in Fedora were so much more recent. The performance is good - I haven't performed any stress-testing yet (which obviously will show a gap between the VM and running natively) but the DCS is running very smoothly and feels very responsive, so I'm confident that the difference in performance is not so large.

How I got the DCS running on Linux is a whole other story... I'll save that another post (F13/F14 DCS installation guides coming soon) but is it ever handy to have a CalDAV server! Previously, I was only able to sync calendars manually (with the USB cable) which made checking for homework assignments extremely annoying, as half of the information was always my iPod and the other half on iCal and I had to sync all the time. Now it's all over-the-air, so as long as there's Internet connectivity the calendar events can be pulled in or pushed out.

Rating: