Category Archives: Web Development

Mac OSX (10.8) Mountain Lion: Fixing Apache, PHP, Subversion, User Sites, Virtual Hosts Directories

While Mountain Lion (OSX 10.8) has brought many enhancements and fixes (mostly performance), it has also caused frustration to old users.

You might have noticed following issues in Mountain Lion:

  1. Web Sharing Preferences Panel has been removed, i.e. you need to launch apache manually or write some launch-agent script or hack to bring web-sharing preferences panel back
  2. User Sites (per-user web directories) is disabled, i.e. http://localhost/~username doesn’t work by default, and you need to modify apache config file to enable it
  3. PHP extension for Apache is disabled by default i.e. you need to enable it by modified apache config (httpd.conf)
  4. Subversion is not installed by default, either you can install using homebrew or by install XCode command line tools

You can fix these issues (1-4) by following these two links:

Whenever I upgrade to newer version of OSX, I end up with broken development-setup i.e. custom permissions on directories are messed up, configuration files are overwritten/removed, etc.

I think, I have found a way to keep default directory permissions, so future upgrades don’t break things.

My development setup requires my virtual hosts to use directories within my home-directory (and outside of ~/Sites or /Library/WebServer/Documents directories).

I am using following technique to setup my virtual-hosts:

  • Enable User Sites  (i.e. fix #2 problem above)
  • Create symbolic-links(symlinks) of your project folder(s) inside ~/Sites directory
  • Enable FollowSymLinks and SymLinksIfOwnerMatch options in virtual-host configuration.

In my case, I have a project inside ~/projects/myproject . I create a symlink of this directory inside ~/Sites, like this using Terminal (command-prompt)

$ ln -s ~/projects/myproject ~/Sites/myproject

I have following virtual-host configuration for this project:

<VirtualHost *:80>
 DocumentRoot "/Users/myusername/Sites/myproject/trunk/web"
 ServerName  myproject
 ServerAdmin myusername@localhost
 Options Indexes MultiViews Includes +FollowSymlinks +SymLinksIfOwnerMatch
 CustomLog "/private/var/log/apache2/myproject_access.log" common
 ErrorLog "/private/var/log/apache2/myproject_error.log"
</VirtualHost>

I use it on my development machine (i.e. my laptop), so I don’t really bother about security at Apache level, and I take care of security at firewall/other levels.

If you are going to use above technique/configuration, please understand everything (by reading documentation) before you use it.

This set up works for me and solves some problems for me – I don’t have to change default directory permissions, and I don’t have to keep my projects within ~/Sites or /Library/WebServer/Documents directory.

Amazon S3 RequestTimeTooSkewed Error

Recently, we have started noticing “RequestTimeTooSkewed” erro while making requests to Amazon S3. The official FAQs suggests following:

Amazon S3 requires all machines making requests be within 15 minutes of an Amazon S3 webserver’s clock

Reading documentation and various blog posts made me believe, this is problem with the date/time settings on machine (which makes request). However, in our case, it turned out to be something else.

We use boto (Python library) for AWS stuff. Boto caches the connection objects (for S3, EC2, SQS, etc.), and tries to reuse those in later calls.

Imagine a simple use-case:

  1. Read data from S3
  2. Process data on EC2-instance/your-server
  3. Store processed-data on S3

In our case, #2 takes longer than 15 minutes (allowed limit by S3) sometimes, hence,  we were noticing ‘RequestTimeTooSkewed’ error.

Anyway, we fixed it by explicitly creating a different/fresh S3(http) connection before sending request to S3. This might sound inefficient, perhaps it is.

This is how we do now, a stripped down version of code from our class:

s3_connection = boto.connect_s3(aws_access_key_id="aws_access_key_id",aws_secret_access_key="aws_secret_access_key")
output_bucket = s3_connection.get_bucket("output_bucket")
key = output_bucket.new_key(key_name)
key.set_contents_from_filename(file_path, file_headers, True, None, 10, file_policy)

I am Python and boto noob; I am sure there would be a better way of doing this, so please share if you know one.

Development Setup – Updated

I posted about our proposed development setup, during these years a few things have changed a bit. More or less, this is what we have:

  • GNU/Linux (Ubuntu) and Windows(some) boxes for developers
  • Eclipse (PDT) IDE with loads some plugins
  • Version Control: Subversion, GIT, GIT-SVN
  • Browsers
    • Firefox
    • Chrome
    • Opera
    • Safari
    • OperaMini (Simulator)
    • FirefoxMobile (Simulator)
  • Plugins for browsers:
    • Firebug (with loads of plugins – YSlow, etc.)
    • Web Developers Tools (firefox)
    • Others (developer’s preference)
  • Developers also use WINE to run some windows software on GNU/Linux

Testing:

  • Windows Box with different browsers (versions, vendors)
  • Windows Box with different Mobile Emulators/Simulators
  • Selenium Plugin for Firefox

Development Servers/Applications:

  • Apache HTTPD
  • Mysql Server
  • Trac
  • MediaWiki
  • PHPMyAdmin
  • ReviewBoard (limited usage)
  • Hudson (limited usage)

CalDAV and SyncML Resources

One of our projects requires a calendar application with bi-directional synchronization with any other calendar applications/services such as Microsoft Outlook, Mozilla Thunderbird, Google Calendar, Yahoo! Calendar, iPhone, Nokia or others.

We can export iCalendar file, that would be readonly i.e. client applications can not write back to source calendar

I started looking at CalDAV, which is an extension to WebDAV, and SyncML, which is gaining traction because most of the mobile devices use it for synchronization of data. I yet to find where CalDAV fits when it comes to mobile devices.

I found out some interesting links, which I am still going through. I thought, it would be nice to share these links:

Beautiful Plogger

Plogger is an open-source photo gallery system built using PHP. It successfully maintains the simplicity while providing so many features, it’s just beautiful piece of work.

Withing five minutes, I got Plogger running on my machine. In another hour, I created a new theme with different visualization (CoverFlow) to display thumbnails.

Having worked many different photo gallery management software/scripts, I find, Plogger is the most beautiful. I might be ignorant about other better systems, please share if you know.

I bet, web designers would find it very handy because they can easily customize and deliver solutions without dealing with complex programming required behind file upload/management.

Don’t live with broken windows

Most of us have heard about “Don’t live with broken windows” or “Broken Window Theory” in software world, through books (Pragmatic Programmers by Andy Hunt and Dave Thomas, The Tipping Point by Malcolm Gladwell) and other sources (wikipedia, blogs, articles, etc).

Like many others, I have also experienced that Broken Window Theory applies to many business and personal-life (and many others) other than software-development.

Over the time I have read books and articles, as listed below to learn more and apply in day to day life. You might following links useful.

Another Common Early Start-up Mistake

In most common early start-up mistakes, Mark Suster talks about very interesting and insightful points. However, I feel like adding one more point, quite known but often taken granted, more specific to software or web start-ups.

If you are a software or web start-up, it’s really important to use the experience of founders (if they are come from technical background) or your core team to have following in order, as soon as possible.

Guidelines and best-practices: code, documentation (wiki), version-control (branching/tagging – when and how?), bug-tracking, testing (unit-tests, functional-tests), deployment, performance objectives and related stuff.

I would not go crazy (get distracted too much) about these initially but have these in place and encourage(mandatory – certain cases) everyone to contribute, follow, discuss and document. It’s lot easier to adapt things at an earlier stage rather than later.

I strongally recommend you to read Martin Fowler‘s article Technical Debt to learn more about the importance of having things in order.

Job Opening: Flash Platform Developer

We are looking for some smart Flash Platform Developers who can be part of our team in Allies Interactive Services Pvt. Ltd., Kanpur, U.P.

We are a design and development company in Kanpur, though we are small but we are ambitious and have a great vision.

I posted the details on Flex-India sometimes back, pasting the same (edited the typos and formatted) over here:-

I have been meaning to post this for sometime but thought would it be appropriate to do that here?

I am part of a small design and development shop in Kanpur, U.P. Where, we mostly do web development using FOSS, mainly LAMP.

I moved to kanpur around 10 months back with a desire to build a great Flash Platform Team that would work on non-trivial type service projects and some great product ideas.

I could now start doing it, after we have managed to fix a lot of issues mostly a nice office, a good culture and some projects and a product in pipeline.

I need an experienced Flash Platform developer in my team, who can help us to make our vision, desire and dreams a reality.

Since Kanpur is not a metro or fancy place to live, it takes more than just technical aptitude to be here. That is some more strong reason f.ex. A desire to be part of a growing team, desire to be close to family, desire to contribute in the development of IT ecosystem in North and/or a desire to prove, hell yeah we can do great stuff from anywhere, even cities like Kanpur :-)

If you think, you want to help me by being part of my team and understand what I meant above, please don’t hesitate to contact me on [abdul dot qabiz at gmail dot com] off-list i.e. Direct email to me, please don’t reply here on this list.

As far as job description goes, I have already given an idea. However, we are looking for someone who understands web very well that is HTTP and other standards. Fundamentally good at problem solving, the real world ones, ActionScript, Flex Framework, Adobe Flash Player and AIR fundamentals and APIs.

Of course, good experience that says about in your behalf. We would also talk to you so things would get clear, i.e. If we are match for each other.

If you want to know more about company, please check out http://www.alliesinteractive.com

Available for consultancy, training and development

I am available for consultancy, training and development services. Following is the rough list of things, I can provide consultancy, training or development services for:-

  • ActionScript 1.0, 2.0, 3.0
  • Adobe Flash/Flex
  • Adobe Integrated Runtime (AIR)
  • Training on Adobe RIA technologies
  • Architecture for RIA
  • Web Application Development
  • Design and Architecture
  • Development for LAMP
  • Integration Services for Flex/AIR with existing Web Apps
  • Development Setup for small teams
    • Subversion Version Control
    • Bug Tracking System (Trac, Wiki)
    • Training on Development Life Cycle
    • Backup Strategies
    • Development Sandbox Setup for RIA development

    JFYI! You can check out my linkedin profile to know more about me. I am based in India and have around ten (10) years of experience, during this period I have worked for Macromedia/Adobe, Yahoo!, Mixercast and TIS and worked as independent-consultant, freelancer, trainer and co-founder. I have been working on various technologies/platforms (some listed above).

    I am a programmer who enjoys solving users’ problems whatever it takes (technology is no constrain). Having said that, I am passionate about ActionScript/Flash/Flex/AIR and Web (in general) which happen to be my core competencies.

    PS: Do you think, this is a shameless sales pitch :-)

    Technorati tags: , , , , , , , , , ,,

    l10n and i18n with Yahoo! R3 project

    I came to know about Yahoo! R3 project (tools), which helps building localized and internationalized websites. The templating system used in R3 is not run-time, it’s rather static (compile-time) which means pages for different locale and intls are generated during build process.
    It’s simple to install using PEAR and requires PHP5+. I like the command-line interface of R3, though it’s easier to use it’s web-based GUI, as shown in documentation. I couldn’t get R3 GUI running, but it seems sometime is wrong, I am not able to get it running on my Mac OSX (Leopard) with Apache HTTP 2.2.x.
    Something similar is used with-in Yahoo!, I would not go in detail rather let you explore R3, which is indeed an exciting project. I am, hopefully, going to use in some project, if I do that, I would post more about my experience with R3.
    Technorati tags: , , , , , ,

    Development Setup

    I have been thinking a lot about a good and scalable development setup for small teams.That means, as team size grows, things don’t have to be changed.

    Server machine(s):-

    I am planning to have all of these one server machine (IBM) in virtualized environment. Subversion and Trac can go in one VM, perhaps under Apache. Second VM can have Apache for web-apps, third VM can have mysql, fourth VM can have MailServer and ActiveDirectory/LDAP?

    Do you think above makes sense?

    Developer/Designer workstations:-

    Though there should not be any restrictions on using a development IDE of choice, but I have realized if entire team uses same IDE things get far easier. The development workflow is easy, knowledge sharing and management is easy. Eclipse, which Aptana is based on, can be used for variety of projects.

    Ubuntu is good operating system, I have been using for over one year, not regularly but quite often. There might be Windows/OSX boxes for designers.

    Why do we need Apache and MySQL on each workstation?

    I think, developers are more effective if they have their own sandbox. They can play with code freely, take certain risks and innovate. There is no harm done. We do face issues, when it comes to sync mysql data into local mysql instances, I think it can be done via some scripts.

    Virtualization can be done on client and I am thinking to do it, specially for folks who are not comfortable with Linux, so they can be on Windows while they also have access to Linux VM, they are encouraged to use Linux VM. They can use Windows box (Host), if something is messed up in Linux VM and there is strict timeline that doesn’t allow to fix VM.

    Over the period, these developers would be comfortable with Linux and that is the time they can start using real Linux box :-)

    These are some thoughts, I might be missing something here. I hope, I would write more in another post.

    As you know, I have been on break and been thinking on all these things. BTW! I don’t work with Yahoo! anymore, once I am done with break I have to figure out what to do. Perhaps, time to be in my own city and do something my own (consultancy, startup or something like that). Heh, that’s news, if you have read so far :-)

    Technorati tags: , , , , , , , , , , , , , ,

    Google Gears: ResourceStore and same-orgin policy

    I spent some time playing with Google Gears LocalServer (ResourceStore) to cache some video files from YouTube/Google-Video on client. It seems, you can only cache (store) data from same-origin. I might be wrong, but this is what I found.
    I would spend more time to find out if there is a way.

    Update: Getting YouTube Video (FLV) URL

    It seems, YouTube has started using Google cache-servers to serve Flash-Videos (FLV). There is now very easy way to get YouTube FLV files.

    http://cache.googlevideo.com/get_video?video_id=<video_id>

    That’s it, video_id can be found at various places:-

    If you click on following link, you would be prompted to download flv :)

    http://cache.googlevideo.com/get_video?video_id=M0ODskdEPnQ&origin=youtube.com

    Update (Jan 11, 2008): Updated the URL for getting FLV from Google Cache server. Thanks to Rohan for sharing updated URL format.

    Update: It seems cache.googlevideo.com doesn’t work, atleast not for me?

    Technorati tags: , , ,