Federico Cargnelutti

Simple is better than complex. Complex is better than complicated. | @fedecarg

Archive for October 2008

Developing cross-platform Adobe AIR desktop applications

with 4 comments

This weekend I decided to spend some time developing my first cross-platform Adobe AIR desktop application. My first impression of Adobe Air was: Wow! It takes only a few minutes to see how easy and powerful this platform is. What’s great about AIR is that you can build Rich Internet Applications that run across operating systems (Win/OSX/Ubuntu) on the WebKit HTML engine and are easily delivered using a single installer file. You can also build desktop applications in JavaScript, a language that nearly everyone is familiar with.

What’s really cool about Adobe AIR is that the extension for Dreamweaver lets you transform a web-based application into a desktop application. Users can then run the application on their desktops and, in some cases, without an Internet connection. I already have a couple of these applications running on my Ubuntu desktop.

Also, Adobe AIR has an embedded database SQLite, which is an SQL92 & ACID compliant database engine with support for storing databases of up to 1TB. You can use this embedded database in your AIR Apps, and send SQL queries to it using JavaScript!

For a quick, hands-on illustration of how Adobe AIR works, read the following tutorials:

Written by Federico

October 25, 2008 at 1:35 pm

Posted in Programming, Tools, Web Apps

Cloning your Ubuntu Installation

with 2 comments

It’s always handy to have a complete list of packages installed, specially if you want to create a system that is similar to a different system you have already set up. In this post I’ll cover how you can export a list of installed packages on one Ubuntu system, and import them into another to build a duplicate system.

Make a copy of the system’s repositories

Copy the /etc/apt/sources.list text file to the destination system over the network.

Export the list of installed packages

$ dpkg --get-selections | grep '[[:space:]]install$' | \\
awk '{print $1}' > ~/package.list

Copy the package.list text file to the destination system over the network.

Prepare the destination system

Update your package list to make sure you get the latest version of the packages:

$ apt-get update

Import the package list

$ cat ~/package.list | xargs apt-get install

That’s it! All of the files from the package list will have been imported into the new system. This doesn’t mean that all of the settings have transferred over. To do that, you will likely need to copy settings from the /etc directory.

Written by Federico

October 22, 2008 at 10:34 pm

Posted in Linux

Full-text searching with MySQL

with 2 comments

MySQL’s full-text search functions provide a simple framework for an easily implemented, approximate site search. Many sites, written in an interpreted language and powered by MySQL, can use MySQL’s full-text search to avoid third party dependencies.

The basics of the MySQL full-text search functions are well-documented in the MySQL online documentation. For those lacking patience, here is a quick rundown.

Continue reading

Written by Federico

October 22, 2008 at 9:58 pm

Posted in Databases

Profiling queries with Zend_Db

leave a comment »

Eran Galperin wrote:

Database performance is one of the major bottlenecks for most web applications. Most web developers are not database experts (and I’m no exception), there are however several basic methods to analyse and optimize database performance without resorting to expert consultants.

The first step I take when profiling database performance for a web app is to measure the running time of all the queries running in it. Absolute run time of a query is not necessarily a good measure of how optimized it is, since some queries are naturally more complex or pull more data – It will give me a good idea however of where to start improving the response time of the application I’m optimizing. My main goal is not specific query performance, but overall system performance.

Continue reading: Profiling queries with Zend_Db

Written by Federico

October 14, 2008 at 3:11 pm

Posted in Databases, Frameworks, PHP

MySQL Master-Master Replication Manager

with one comment

The MySQL Master-Master replication (often in active-passive mode) is popular pattern used by many companies using MySQL for scale out. Most of the companies would have some internal scripts to handle things as automatic fallback and slave cloning but no Open Source solution was made available.

In 2007, the High Performance Group at MySQL AB was asked to implement such solution for one of their customers and they kindly agreed to let them release the software under GPL2 license.

The MySQL Master-Master Replication Manager (MMM) is a set of flexible scripts to perform monitoring/failover and management of MySQL Master-Master replication configurations (with only one node writable at any time). The toolset also has the ability to read balance standard master/slave configurations with any number of slaves, so you can use it to move virtual IP addresses around a group of servers depending on whether they are behind in replication.

Links

Written by Federico

October 14, 2008 at 3:02 pm

Posted in Databases, Tools

Webgrind, a Web frontend for Xdebug

leave a comment »

Webgrind is an Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick and dirty optimizations it does the job.

Features

  • Super simple, cross platform installation.
  • Track time spent in functions by self cost or inclusive cost. Inclusive cost is time inside function + calls to other functions.
  • See if time is spent in internal or user functions.
  • See where any function was called from and which functions it calls.

Installation

  1. Download Webgrind.
  2. Unzip package to favourite path accessible by a Web server.
  3. Load Webgrind in browser and start profiling.

More info

Written by Federico

October 7, 2008 at 10:04 pm

Posted in PHP, Web Apps

The Ubuntu Revolution Begins Today

with 7 comments

A technology revolution will start today. Most people don’t know about it. In fact, most people won’t hear about today’s events for another 4 to 6 years. But circle October 6, 2008 on your calendar. A decade from now, historians will say today was the day Open Source reached its tipping point.

You want to know why? Today my wife joined the Ubuntu Team!

Good luck on your first day, hope it all goes well.

Written by Federico

October 6, 2008 at 11:18 pm

Posted in Linux

Solar Framework: MySQL Replication Adapter

with 6 comments

As part of the Solar-1.0.0alpha2 release, Paul M. Jones included an SQL adapter that lets you connect to master/slave MySQL installations.

Replication

Replication enables data from one MySQL database server (called the master) to be replicated to one or more MySQL database servers (slaves). Replication is asynchronous – your replication slaves do not need to be connected permanently to receive updates from the master, which means that updates can occur over long-distance connections and even temporary solutions such as a dial-up service. Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a data.

Solar Adapter

When you get into a situation where you need to scale up, you might need a replicated MySQL database setup. In such cases, there is one “master” server that handles reads and writes, and there are one or more “slave” servers that are read-only. This means you need to pick which server you’re going to connect to based on the kind of statement you need to issue (SELECT, INSERT, UPDATE, etc).

The Solar_Sql_Adapter_MysqlReplicated adapter handles all the connections and switching-around for you, and you don’t need change a single line of application code. All you need to do is modify your configuration file to tell it where your master and slave servers are.

More: Adapter for Master/Slave MySQL Setups

Related Links

Written by Federico

October 6, 2008 at 10:07 pm

Posted in Databases, Frameworks, PHP

Meet Intrepid Ibex, also known as Kubuntu 8.10

with one comment

Intrepid Ibex is the codename for Kubuntu 8.10, due to be released October 30 2008.

The focus for 8.10 for the Kubuntu community will be transitioning to a KDE 4 desktop. The plan is to integrate the existing Kubuntu software while at the same time offering the best out-of-the-box KDE 4 experience around. Intrepid Ibex is a whole new revolution for the open-source community, Intrepidly going where no Kubuntu release has gone before.

The key improvements in Kubuntu 8.10 are:

  • The KDE-PIM suite is back
  • Plasma matures
  • Many new and improved applications and frameworks

KWin

KWin’s desktopgrid visualizes the concept of virtual desktops and makes it easier to remember where you left that window you’re looking for.

Plasma

The new folderview applet lets you display the content of arbitrary directories on your desktop. Drop a directory onto your unlocked desktop to create a new folderview. A folderview can not only display local directories, but can also cope with locations on the network.

More info here

Written by Federico

October 4, 2008 at 12:46 pm

Posted in Linux

Make your site run 10 times faster

leave a comment »

This is what Mike Peters says he can do: make your site run 10 times faster. His test bed is “half a dozen servers parsing 200,000 pages per hour over 40 IP addresses, 24 hours a day.” Before optimization CPU spiked to 90% with 50 concurrent connections. After optimization each machine “was effectively handling 500 concurrent connections per second with CPU at 8% and no degradation in performance.”

Mike identifies six major bottlenecks

Written by Federico

October 4, 2008 at 11:00 am

Follow

Get every new post delivered to your Inbox.

Join 43 other followers