domenica 1 luglio 2007

lunedì 26 marzo 2007

iPhone

Introducing iPhone

Introducing iPhone

iPhone combines three amazing products — a revolutionary mobile phone, a widescreen iPod with touch controls, and a breakthrough Internet communications device with desktop-class email, web browsing, maps, and searching — into one small and lightweight handheld device. iPhone also introduces an entirely new user interface based on a large multi-touch display and pioneering new software, letting you control everything with just your fingers. So it ushers in an era of software power and sophistication never before seen in a mobile device, completely redefining what you can do on a mobile phone.

venerdì 23 marzo 2007

Apple.it Venerdi 23 Marzo 2007


Apple TV.If it's on iTunes, it's on TV. Now shipping.

blueMarine


An open source application for the digital photo workflow, the blueMarine project will provide you all-in-one tool for managing your photos, from the shoot up to the archiving and beyond. blueMarine is an expandable, open platform and includes specific support for different photographers communities, as well as the latest technologies.

Welcome to blueMarine

blueMarine foundation is very similar to existing applications such as Adobe Lightroom or Apple Aperture: a photo browser, which can be explored in different ways (by folder, by calendar, by tags, by galleries). This is just a core upon which different modules can be plugged in. The aim of blueMarine is to fully support the photographic workflow, even before the photo shoot (for instance, trip planning supported by maps) and beyond print or archival. For instance, an ornithologist usually manages field notes about the bird observed and photographed: directly binding them to photos and maybe GPS positioning data is much better than keeping a separate Excel sheet.

blueMarine focus is also on communities. Different photographer communities (e.g. astrophotographers, birdwatchers) have different requirements, both in the concrete data processing and in the cataloguing. With the support of the proper plugin, blueMarine aim is to be the single application for all the user needs.

blueMarine is also exploring new technological frontiers. For instance, there's ongoing work to support distributed computing, for instance small clusters at home made of a laptop and one or more desktops. Users owning more than a single computer will be able to make full use of all their computational power.

We don't want to put bounds to our imagination. Currently blueMarine supports the import of GPS trip data so you can geotag your photos and archive all your trips. We're thinking of advanced trip planning, such as taking advantage of weather forecasts, computing the sun position with respect to the target on a map, and so on. More about this in the vision document.

Of course, being open sourced, blueMarine is open to contributions. Indeed the project aim is ambitious, and can't be reached without an active community of developers. We welcome any volunteer, even only for testing the application or writing the documentation. See the volunteering section.

RAW format support

blueMarine, in addition to the common image formats such as JPEG and TIFF, also supports RAW formats from most manufacturers: CR2, CRW, DNG, MRW, NEF, PEF, SRF. The support is still partial, as image quality is not guaranteed at the moment (e.g. colors aren't reproduced accurately).

Editing

The current release of blueMarine has no editing features. They are being developed right now, and will include support for RAW formats.

Quality

blueMarine wasn't born with the idea of delivering a product. Originally it was just a technologic demonstrator, thus lacking quality assurance. Only in 2006 it got a critical mass and the author definitely decided to retarget it. At the moment the QA is insufficient and the product is not yet suitable for production use. The currently released 0.9.EA8 has blocking problems on Linux and Windows. Don't download it if you think to use it - blueMarine at the moment can be only evaluated. Of course, you can also contribute to it. If you decide not to download it yet, but would like to be informed about future releases, please subscribe the news feed.

Tutorial and screencasts

We're still writing some introductory documentation about blueMarine. A draft tutorial is available, as well as a screencast describing some of the main features of the application.

License

blueMarine is available under the Apache License 2.0.

Download

Download the latest Early Access from the download page.

Tutorial: AJAX Made Easy

On the heels of two very successful tutorials on creating a collapsible div and an animated sliding div, I’ve decided to write another. It seems my last few helped a number of programmers learn a simple trick, and hopefully this one will do the same.

Note, I’ve also upgraded to a much newer, faster server, so hopefully the social networking sites won’t “collapse my server” again, as one Digger so eloquently put it. :)

Hearing about AJAX constantly, but never have found time to read a lengthy, frustrating, complex tutorial? In the following post, I’m going to explain how to add AJAX functionality to your website in three easy steps. It’s actually quite simple, and I’m going to try and be clear and to the point, but not over or under-explain anything like most tutorials have a tendency to do.

Before you begin, decide what purpose or additional functionality adding AJAX to your website will accomplish. Will it be a live search feature? Something to save user preferences? In this example, we’re developing a simple calculator. Let’s dive in.

Step 1: Create the Intelligence
First let’s make the brain of the system. In our calculator, we’re going to need a PHP function to actually perform the operations. We’ll handle the front-end later, but for this file, we’ll take our input from GET request strings (variables passed through the URL itself, such as file.php?var=value&var2=test).

Name this file: backend.php
if($_GET['op']=="" || $_GET['num1']=="" || $_GET['num2']==""){
echo "Error: Please complete all fields.";
exit;
}

if($_GET['op'] == "divide" && $_GET['num2'] == "0"){
echo "Error: Division by zero.";
exit;
}

if(!is_numeric($_GET['num1']) || !is_numeric($_GET['num2'])){
echo "Error: Invalid numbers.";
exit;
}


switch($_GET['op']){
case "add":
echo $_GET['num1'] + $_GET['num2'];
break;
case "subtract":
echo $_GET['num1'] - $_GET['num2'];
break;
case "multiply":
echo $_GET['num1'] * $_GET['num2'];
break;
case "divide":
echo $_GET['num1'] / $_GET['num2'];
break;
}
?>

Now, let’s take a look at this file. We’re working with three variables passed from the GET string: the operation such as add/subtract/divide/multiple ($_GET[’op’]), and the two numbers we’re performing the math on ($_GET[’num1′] and $_GET[’num2′]). For example, we might call this page like this: backend.php?op=add&num1=12&num2=4 . This is running our above file (backend.php), passing “add” as the ‘op’ variable, and 12 and 4 as the two numbers.

The first four lines of the above backend.php script checks to make sure all the variables were entered. If any of the three values are blank (”"), then it errors and exits. The next if-block is checking for a divide by zero error. If the op variable is divide and the num2 variable is zero, it errors and exits. Simple.

Next it checks to ensure you entered valid numbers with the is_numeric() function in PHP. If you enter a letter or something else in the field, it will show and error and exit.

The next (and last) block we get to is the switch statement. This goes through and checks the op variable to see what we’re trying to do here. Every case-statement represents one of the possible operations (add/subtract/divide/multiply). When it figures out which operation is being requested, it performs the math on num1 and num2, echo’s the result, and breaks out of the switch statement, thus ending the file. If you need to brushen up on how switch statements work, php.net has a great tutorial.

There, now you’re 1/3rd done with adding interactive AJAX functionality to your web application. Easy right?

Step 2: Create the Form
Now we’re going to create the frontend to the AJAX. This is the part the user sees, and is mostly basic HTML. You can add this to any PHP or HTML file you have, anywhere you want.

Here’s the frontend code for our calculator:





This is simple HTML, adding two textboxes, a drop-down (with values corresponding to the values of the case statement in backend.php), a button, and a DIV. Notice I’m not using a submit button (it doesn’t matter) because I’m not using a form. This might not be best practice, but it goes to show you’re not submitting anything to another page, like you traditionally would. The button has a function “doMath()” which is called from the onClick attribute. We’ll explain this function in step 3, but for now, just know that begins the AJAX and solves the math problem. Also notice we’re using id’s instead of names for the textboxes and drop-down field (select)- this is for us to reference the fields from Javascript in the next step. The last line is a simple DIV with a bit of CSS styling (display: inline makes it appear after the equals button, rather than on it’s own line, and the font size is for aesthetics). We set the id of this div to “answer”, and we’ll be using it later from the Javascript to output the answer.

Very easy. Now we have the backend setup to do the math, and the frontend to ask the user what kind of math he wants to do… so now the only piece left is connecting them together!

Step 3: Connecting the Frontend and Backend Together
This step is the trickiest, but stick with me, and you’ll see how easy it really is. We use Javascript (AJAX = Asynchronous Javascript and XML) to talk between the HTML and the PHP.

For this step, let’s create another new file, and call it ajax.js.

http = getHTTPObject();

function getHTTPObject(){
var xmlhttp;

/*@cc_on

@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/

if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
try {
xmlhttp = new XMLHttpRequest();
}catch(e){
xmlhttp = false;
}
}

return xmlhttp;
}

function doMath(){
var url = "backend.php?op=" + document.getElementById('op').value;
url += "&num1=" + document.getElementById('num1').value;
url += "&num2=" + document.getElementById('num2').value;

http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;

http.send(null);
}

function handleHttpResponse(){
if(http.readyState == 4){
document.getElementById('answer').innerHTML = http.responseText;
}
}

Now, your first reaction might be to panic, but stay calm, it’s not that bad. The entire getHTTPObject() function (half the file) you do not need to understand. It’s a standard function included in almost every AJAX script out there… simply copy and past that exactly as it is, and forget about it. There, now you’re just left with the first line, the doMath() function, and a small function called handleHttpResponse.

The first line is declaring an object to ask PHP for it’s result. Think of it as a mini web browser.

The doMath() function is where you actually send the AJAX request. Remember it being called when you click that button in the frontend? This is what’s run. The first three lines of this function are building a variable (url) that is the PHP page we’re going to request. It begins with “backend.php?op=” and grabs the value of the drop-down from the frontend to find out if we’re adding, subtracting, multiplying, or dividing. Then it adds the two numbers from the frontend on to the end of URL request string as well, using document.getElementById to find them (the textboxes’ values). Now the url variable is left with something similar to the example I gave right after the code in step 1. You could in theory plug this URL into your web browser, and see the result yourself, but instead we’ll let Javascript do it for us. The last three lines of the doMath() function pass that URL to our mini web browser (variable “http”), and essentially press the Go button. It sends the request, and tells it to notify us when it gets a response back, via the handleHttpResponse() function.

Now, the last function of our Javascript file is the handleHttpResponse() function… called automatically by our mini web browser when our PHP page finishes downloading (and it has an answer). The if-statement is basically saying “if the PHP site is done loading and you have an answer, continue.” The middle line is a call to set the innerHTML property of the answer DIV on the frontend to whatever the PHP page says…. in our case… the math answer.

Important!
Now, for this to work, you need to call the ajax.js file from the file where your frontend is. This is done by simply placing this line above the frontend somewhere in the code:

The best place to put this is between the HEAD tags of the file, but anywhere would work. If you do not add this line, your website will give errors when someone tries the AJAX, and it won’t work.

And you’re done!

Now, I’m sure critics are going to ask why do this with AJAX when I could easily accomplish the same thing with pure Javascript, and the answer is this is a tutorial to learn. Often times the PHP backend does MySQL calls, or things that Javascript couldn’t do. For example, live searches (results below the textbox as you type) are this same basic framework, but the backend searches a database for what the user is typing, and returns the results to set in the answer div (equivalent). Simple! :)

And as always, here is a live, working demonstration of the tutorial in action:

I enjoy your comments and requests for future tutorials!

mercoledì 21 marzo 2007

Ecco lo "scooter" con una ruota


scooter con una ruota

In Gran Bretagn, Ben Smither ha pensato di costruirsi una specie di skate autobilanciante che utilizza una sola, larga ruota per gli spostamenti.

Il pricipio di base è quello del Segway, ovvero un giroscopio motorizzato, ma per costruirlo sono stati spesi solamente 300£ (circa 440€), ovvero il costo dei materiali.

Dopo il salto potrete vedere il video dimostrativo, dove noterete che alcuni dettagli sono ancora da perfezionare (come il sistema di frenata), ma in futuro potrebbe sfidare il Segway non credete?

Memoria SSD da 128GB

pubblicato da Federico Illesi in:

Questo fine settimana per me è stato molto proficuo sotto il punto di vista tecnologico perché -grazie ad un amico- ho potuto testare l’ormai famosa e attesa memoria SSD da 2,5” con ben 128GB di spazio. L’azienda, trattandosi ancora di un prototipo, mi ha chiesto di rimanere anonima (la foto che vedete qui a lato non è direttamente connessa al post) e di non diffondere altre informazioni se non i dati sulla velocità -quasi sorprendente- con cui lavora.
La memoria di tipo NAND impiega circa 110µs per accedere ad un file, ovvero 100 volte meno degli attuali hard disk; questo si fa molto sentire soprattutto all’avvio del sistema operativo, quando si visualizzano molte foto o si aprono programmi molto pesanti. Inoltre, i consumi sono a conti fatti dimezzati, con buona pace per la batteria dei computer portatili.

Infine, per mettervi un po’ il cuore in pace, vi informo che se dovesse essere venduta ora la memoria avrebbe un prezzo sicuramente superiore ai 2000€. Non ci resta quindi che sperare in una prossima diffusione a livello mondiale per abbatterne i costi.

Talk to Me