techno surprises

January 24, 2008

Translator Live Communication

After Google Translate Live.com published a beta  translator service which is using the  systransoft technology.

Link: http://translator.live.com/

Technology: http://www.systransoft.com/

HTML 5

Filed under: html, html 5, w3, w3.org, w3c — Mustafa Turan @ 3:13 pm

W3C Publishes HTML 5 Draft, Future of Web Content

2008-01-22: W3C today published an early draft of HTML 5, a major revision of the markup language for the Web. The HTML Working Group is creating HTML 5 to be the open, royalty-free specification for rich Web content and Web applications. “HTML is of course a very important standard,” said Tim Berners-Lee, author of the first version of HTML and W3C Director. “I am glad to see that the community of developers, including browser vendors, is working together to create the best possible path for the Web.” New features include APIs for drawing two-dimensional graphics and ways to embed and control audio and video content. HTML 5 helps to improve interoperability and reduce software costs by giving precise rules not only about how to handle all correct HTML documents but also how to recover from errors.

Source: http://www.w3.org/TR/2008/WD-html5-20080122/

January 23, 2008

PHP – MSSQL to XML

Filed under: code, column, connect, connection string, mssql, name, php, php mssql, row, sample, software, xml — Mustafa Turan @ 4:04 pm

These piece of PHP code is help to understand;

  • How to get column names from MSSQL with PHP?
  • How to get related row attributes from MSSQL with PHP?
  • And how to convert MSSQL tables to XML data store type?

Here is the source code, it is completely free and usable for any purposes.

<?php

// Coder Mustafa Turan

// https://mustafaturan.wordpress.com/
// get query from URL
$query    = urldecode($_GET[‘q’]);
if(empty($_GET[‘q’])) exit();
echo “<?xml version=\”1.0\” encoding=\”UTF-8\”?>”;
    /*
    sample query:
    $query = “SELECT * FROM table_name”;
    */

    // connection open to MSSQL
    $link = mssql_connect(‘hostname’, ‘username’, ‘password’);
    mssql_select_db(‘dbname’, $link);

    // get the query result
    $result = mssql_query($query, $link);
    $i = 0;

    // get all columns readed from query
    while ($column = mssql_fetch_field ($result)){
        $columnx[$i] = $column->name;
        $i++;
    }
    $column = null;

    // read all rows with its column name
    while (($row = mssql_fetch_array($result, MSSQL_BOTH)))
    {
        echo “\n <new_row>”;
        foreach($columnx as $C){
            // $C                : column name
            // $row[$C]            : it give the current rows’ column variable
            // sample output    : <column_name>column_content</column_name>
            echo “\n  <” . $C . “>” . $row[$C] . “</” . $C . “>”;
        }
        echo “\n </new_row>”;
    }

    // close the current connection
    mssql_free_result($result);
    mssql_close($link);
echo “\n</xml>”;
?>

Create a free website or blog at WordPress.com.