iMic for my Mac mini

iMic

I think that is very weird that Mac mini doesn’t have a mic or a simple line-in interface, i had to wait for 15 days and pay for the iMic 53 €.
For those who doesn’t know what it is:

The iMic universal audio adapter is a USB device that adds stereo input and output to your Mac or PC. Connect virtually any microphone or sound input device to your iBook, PowerBook, PowerMac or other Mac or PC with a USB port. Yes, iMic supports both Mic level and line level input. It also supports line level output for connecting speakers or an external recording device.

Apple’s G5 versus x86, Mac OS X versus Linux

Mac OS X

I’ve found an interesting article comparing Apple’s G5 versus x86 and Mac OS X versus Linux.
Basically resumes to this:

Workstation, yes; Server, no.

The G5 is a gigantic improvement over the previous CPU in the PowerMac, the G4e. The G5 is one of the most superscalar CPUs ever, and has all the characteristics that could give Apple the edge, especially now that the clock speed race between AMD and Intel is over. However, there is still a lot of work to be done.

The server performance of the Apple platform is, however, catastrophic. When we asked Apple for a reaction, they told us that some database vendors, Sybase and Oracle, have found a way around the threading problems. We’ll try Sybase later, but frankly, we are very sceptical. The whole “multi-threaded Mach microkernel trapped inside a monolithic FreeBSD cocoon with several threading wrappers and coarse-grained threading access to the kernel”, with a “backwards compatibility” millstone around its neck sounds like a bad fusion recipe for performance.

Workstation apps will hardly mind, but the performance of server applications depends greatly on the threading, signalling and locking engine. I am no operating system expert, but with the data that we have today, I think that a PowerPC optimised Linux such as Yellow Dog is a better idea for the Xserve than Mac OS X server.

No more mysteries:
Apple’s G5 versus x86, Mac OS X versus Linux Part One, Part Two

“Submitting a bug to PHP” - The novel

This is my first(and the last) time of an attempt to submit a bug to PHP.
I am using PDO in PHP5 and my Apache gets a “Segmentation Fault” when I execute an invalid SQL statement.

[26 Aug 8:02pm CEST] nmariz at estadias dot com

Description:
————
Segmentation fault in Apache when executing an invalid SQL.

apache error.log:

[Fri Aug 26 18:10:42 2005] [notice] child pid 26519 exit signal
Segmentation fault (11)

Actual result:
————–
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1079565216 (LWP 28567)]
0×40865cf5 in _efree (ptr=0×83bbf58) at
/root/software/php-5.1.0RC1/Zend/zend_alloc.c:302
302 REMOVE_POINTER_FROM_LIST(p);
(gdb) bt
#0 0×40865cf5 in _efree (ptr=0×83bbf58) at
/root/software/php-5.1.0RC1/Zend/zend_alloc.c:302
#1 0×40727109 in pdo_mysql_stmt_dtor (stmt=0×0, tsrm_ls=0×817ecf8) at
/root/software/php-5.1.0RC1/ext/pdo_mysql/mysql_statement.c:45

(…)

[26 Aug 9:29pm CEST] xxx@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.

A proper reproducing script starts with < ?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

[29 Aug 10:42am CEST] nmariz at estadias dot com

Segmentation fault when executing an invalid SQL statement:

< ?php
(…)
// invalid sql statement
$query = ‘SELECT id name,text FROM modules’;
$stmt = $this->dbconn->query($query);
$result = $stmt->fetchAll();
$stmt = null;
return $result
(…)
?>

[29 Aug 1:24pm CEST] xxx@php.net

What part in “a short but complete example script” did you not
understand?

[29 Aug 5:00pm CEST] nmariz at estadias dot com

What part in “Segmentation fault when executing an invalid
SQL(_____ANY_____) statement” did you not understand?
I think that you don’t need more code to understand what i mean.

[29 Aug 5:07pm CEST] xxx@php.net

I think you don’t understand that I am very very lazy.
And that your problem _might_ be somewhere ELSE than in the query part.
So either give the full code or go away.

Unbelievable!

UPDATE:
After i had submitted the code that he asked, the guy simply erased all logs and submitted this:

[29 Aug 11:34pm CEST] xxx@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.

A proper reproducing script starts with < ?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

You can see the log in here.

Django: Another “Rails” Web Framework

The Rails hype continues:

Django for Python is the most recently announced of what is becoming a long line of web frameworks inspired by Ruby on Rails. Others that have popped up include MonoRail for .NET & Mono, Subway for Python, Trails for Java, Catalyst and Maypole for Perl. In the context of all these rails derivatives, this article on “Could Rails have been built without Ruby?” is an interesting read. [source]

For PHP we have also cake and biscuit.

The big question!

The ring

This weekend i’ve popped the big question to the woman of my dreams.
You may wonder about the shape of the ring - it has the shape of the infinity symbol with two beautiful opals.
I thought it was quite apropriate since my girlfriend is a math teacher and this is how i feel about us as a couple.
We stayed in Gerês [Portela do Homem, Room View 1, Room View 2].
I’ve enjoyed a really remote place called Monte Sta. Isabel [Picture 1, Picture 2, Picture 3] that we discovered in the top of the mountains.
At one point we didn’t go further because we found a lot of traffic ;)

By the way, she said YES! ;)

The PHP native template engine

“Why using templates engines if PHP is itself a template engine?” said Karlus some time ago.
The answer is: The templates engines can be a great help when you’re using a PHP framework that is built on modules(using MVC design pattern) where is necessary to fetch pieces of HTML to build a page, separating all code of PHP from HTML.
But the overhead of this templates engines is enormous, because of the all parsing envolved. So templates engines is not all about a sea of roses.
I have used Smarty for this kind of work for a long time and, in my opinion, is the best.
When i read this article i realized Karlus point of view. So based on this idea i have developed a small class that enables all funcionality that Smarty has (witch i use) but using the PHP natively as the parser.
It’s a class with only 160 lines of code(without comments), so don’t expect too much…

Features:

Using templates that are PHP files

Including templates inside templates

Caching with expired system in seconds or without expiration

Caching with id’s

Plugin system, as simple as you can get

Discover the diferences with a simple template:

Smarty template (index.tpl)

<html>
<body>
{include file="header.tpl"}
Title: {$title} 
List: 
{foreach from=$list item=list_item}
{$list_item} 
{/foreach}
</body>
</htm>

Smarty object creation (index.php)

<?php

require_once(‘lib/smarty/Smarty.class.php’);

$smarty =& new Smarty();
$smarty->template_dir = ’smarty/templates/’;
$smarty->compile_dir = ’smarty/templates_c/’;
$smarty->cache_dir = ’smarty/cache/’;
$smarty->caching = 1;

$smarty->assign(‘title’, ‘My Title’);
$smarty->assign(‘intro’, ‘The intro paragraph.’);
$smarty->assign(‘list’, array(‘cat’, ‘dog’, ‘mouse’));
$smarty->fetch(‘index.tpl’);

?>
 

My Template (index.tpl)

<html>
<body>
<?=$this->includeTemplate("header.tpl");?>
Title: <?=$title;?> <br />
List: <br />
<?php foreach ($list as $item):?>
<?=$item;?> <br />
<?php endforeach; ?>
<html>
<body>

My Template object creation (index.php)

<?php

require_once(‘lib/Template.php’);

$tpl =& new Template();
$tpl->setTemplatesPath(‘templates/’);
$tpl->setCache(true);
$tpl->setCachePath(‘cache/’);
$tpl->setCacheId(‘nuno’);
$tpl->setExpire(0);

$tpl->assign(‘title’, ‘My Title’);
$tpl->assign(‘intro’, ‘The intro paragraph.’);
$tpl->assign(‘list’, array(‘cat’, ‘dog’, ‘mouse’));
$tpl->fetch(‘index.tpl’);

?>

Results

The time results shown below, were measured with average results to have a more accurate benchmark.
The benchmarking was made in a Celeron 2400Mhz with 512Mb of RAM.
The Y axis corresponds to the average time in seconds per request and the X axis to the number of requests.


Download

You can download the source code here.

Debian GNU/Linux 3.1r0 (finally) released

Debian -- The Universal Operating System

Debian GNU/Linux 3.1r0 (Sarge) has been released to the ftp mirrors. The full download is available on 14 CDs or 2 DVDs.

This release includes a number of up-to-date large software packages, such as the K Desktop Environment 3.3 (KDE), the GNOME desktop environment 2.8, the GNUstep desktop, XFree86 4.3.0, GIMP 2.2.6, Mozilla 1.7.8, Galeon 1.3.20, Mozilla Thunderbird 1.0.2, Firefox 1.0.4, PostgreSQL 7.4.7, MySQL 4.0.24 and 4.1.11a, GNU Compiler Collection 3.3.5 (GCC), Linux kernel versions 2.4.27 and 2.6.8, Apache 1.3.33 and 2.0.54, Samba 3.0.14, Python 2.3.5 and 2.4.1, Perl 5.8.4 and much more.

This is the first Debian release that includes OpenOffice.org (1.1.3). It also features cryptographic software integrated in the main distribution. OpenSSH and GNU Privacy Guard are included in the default installation, and strong encryption is present in web browsers, web servers, databases, and many other applications available in this release.

My new assistant

My new assistant...

It’s a pleasure to present you, my new assistant.
It is a she, with only 4 weeks. She starts to show some interest in my Linux Debian logo and becoming a real geek.
She don’t have a name for the time being, suggestions are welcome ;)

Voyager 1 has left the building

Voyager - Spacecraft

Voyager 1 has officially left the solar system, having crossed the so-called termination shock in December last year. The craft crossed the boundary 94 astronomical units (the distance from the Earth to the sun is one AU) from the sun, according to NASA researchers based in Washington DC.
Read more at The Register.

Learn Portuguese from a Rails application

Tim Case has recently launched theVerbalizer. It’s a learning tool for getting into Portuguese using a method of remembering verbs as the prime driver.
You can find more information in here.

« Previous PageNext Page »