Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 14

Displaying posts with tag: html (reset)

Getting XML and HTML output.
+1 Vote Up -1Vote Down

Many people use MySQL in the console to execute a simple command, but did you know that MySQL can format the result of the query directly to XML or html?

The option -X will output the query result as XML
-H can be used to generate a HTML table containing the data.

$ mysql -X -e "select * from test" test
<?xml version="1.0"?>
 
<resultset statement="select * from test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <row>
	<field name="test">152710</field>
  </row>
</resultset>

Output as HTML

$ mysql -H -e "select * from test" test
<table border="1">
<tbody>
<tr>
<th>test</th>
</tr>
<tr>
<td>152710</td>
</tr>
</tbody>
</table>
The blog was down yesterday
+0 Vote Up -0Vote Down

The brief outage was due to a scheduled move of the servers to a separate rack and subnet dedicated to our work with the Center for Information Assurance & Cybersecurity (ciac) at the University of Washington Bothell (uwb), and a11y.com

I am currently exercising the new (to us) equipment and hope to winnow the less than awesome equipment over the next quarter. I spent the last six months finding the best in breed of the surplussed DL385 and DL380 chassis we (work) were going to have recycled. The team and I were able to find enough equipment to bring up one of each with eight and six gigs of memory, respectively. These will make excellent hypervisors for provisioning embedded instances of Slackware, Fedora, RHEL, CentOS, Debian, FreeBSD, OpenSolaris, OpenIndiana, FreeDOS, etc.

When I initially configured this xen paravirt environment, I failed to plan for integration with libvirt, so I am

  [Read more...]
When to escape your data
+1 Vote Up -0Vote Down

Two examples of escaping data are the following:

The question I'd like to ask today is, when to do this? There are two possible moments:

  • Right when the data comes in. For SQL this used to be done with 'magic quotes' quite a bit in PHP-land. In general I don't see this happening a lot anymore for SQL. I do however see data encoded using htmlentities/htmlspecialchars before entering the database.
  • The other way to go
  •   [Read more...]
    Why is my database slow?
    +0 Vote Up -0Vote Down

    Not part of my Don’t Assume series, but when a client states “Why is my database slow”", you need to determine if indeed the database is slow.

    Some simple tools come to the rescue here, one is Firebug. If a web page takes 5 seconds to load, but the .htm file takes 400ms, and the 100+ assets being downloaded from one base url, then is the database actually slow? Tuning the database will only improve the 400ms portion of 5,000ms download.

    There some very simple tips here. MySQL is my domain expertise and I will not profess to improving the entire stack however perception is everything to a user and you can often do a lot. Some simple points include:

    • Know about blocking assets in your <head> element, e.g. .js files.
    • Streamline .js, .css and images to what’s needed. .e.g. download a
      [Read more...]
    Apple’s new policy is good for you, me, and the web
    +0 Vote Up -0Vote Down

    I like both Adobe (Lightroom rocks!) and Apple (iPad rocks!), but I’ve been asked over and over again what I think about Apple’s new 3.3.1 policy. You know, the one that basically bans cross-platform development frameworks. And, in particular, basically nails the Flash coffin shut on iPhone/iPod/iPad. So, what do I think?

    I love it.

    And I’m surprised more developers, end users, business leaders, and general web standards lovers everywhere aren’t posting about how great this is.

    It’s good for end users.

    The App Store already has a signal-to-noise problem. With hundreds of thousands of apps, finding the good stuff is tough. Bear in mind that every single one of those Apps was built by

      [Read more...]
    Best practices for escaping HTML
    +0 Vote Up -0Vote Down
    I am working on Wordcraft, trying to get the last annoying HTML validation errors worked out.  Thinks like ampersands in URLs.  In doing so, I am asking myself where the escaping should take place. In the case of Wordcraft, there are several parts to it.
  • The code that pulls data from the database.  Obviously not the right place.
  • The code that formats data like dates and such.  It also organizes data from several data sources into one nice tidy array.  Hmm, maybe
  • The parts of the code that set up the output data for the templates.
  • The templates themselves.
  • Now, I am sure 1 is not the place.  And I really would not want 4 to be the place.  That would make for some ugly templating.  Plus, the templates, IMO, should
      [Read more...]
    Open Source Web Design
    +0 Vote Up -0Vote Down
    So, my wife told me that my site design was boring.  Yeah, she was right.  I am no designer.  I just don't have that gene.  But, during my work on Wordcraft, I came across some cool places to find designs that are relased under Open Source licenses.
    • Open Designs - This is arguably the the prettiest of the three. The search, however, is painfully slow because all results return on one page.  I guess if you can wait, this is a plus as browsing is easier.  Also, you can pick multiple colors and choose by license.  They only list XHTML templates (at least as search options).  That could be a turn off if you like HTML 4 like me.
    • Open Web Design - The site itself could use a design overhaul.  But, the content is good.  The search lets you choose

      [Read more...]
    My editor of choice
    +0 Vote Up -0Vote Down
    A
    O?Reilly Open Source Conference Day One
    +0 Vote Up -0Vote Down
    A
    dealnews.com is hiring
    +0 Vote Up -0Vote Down

    From our jobs page:

    As a dealnews web developer, you will help maintain our current stable of deal and price-tracking web sites, and build new features and new web sites as we continue to grow. You’ll be part of a small, fast-moving team of developers that are involved at every stage of product development, from concept to rollout.

    We use Gentoo, Apache, PHP and MySQL.   While that does not need to be your expertise, it is a plus.  We have a little Perl and Python thrown in as well.  You will need to code on a non-Windows system as we run our development environment on our local machines.  Currently, we all use Macs.

    A big plus, however, is disc golf.  We play weekly as an um, team building excercise. Yeah, team building.

    PHP - Populate HTML Select Element
    +0 Vote Up -0Vote Down

    There is many ways to populate vales into a HTML select element. Here is one example I’ve come up with.

    PHP Code Example

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    <select size="1" name="szFooBar[]" multiple="multiple">
    < ?php
    $i=0;
    while($obResults = mysql_fetch_row($saResults))
    {
        if ($_POST['szFooBar'] == $obResults[0])
        { $szSelectedValue[$i] = " selected=\"selected\""; }
        else { $szSelectedValue[$i] = ""; }
     
        printf("<option value=\"%s\"%s>%s\n",$obResults[0], $szSelectedValue[$i], $obResults[1]);
        $i++;
    }
    ?>							
    </select>

      [Read more...]
    Docbook XHTML generation with tidy, chapter the third
    +0 Vote Up -0Vote Down
    In chapter the first, I presented a way to install HTML tidy.

    In chapter the second, I created a script to install the most recent version of tidy with a single command.

    In this chapter, I will show you how to run tidy in a way that cleans up the HTML that was generated by Office™.
    Docbook XHTML generation with tidy, chapter the second
    +0 Vote Up -0Vote Down
    In Chapter the First, we presented a set of commands you could run to install HTML Tidy on your system.

    In this chapter, we will present a script that you may run on your Linux or OS X system to install the most recent version of HTML tidy.

    You may use subversion, wget, or your favorite browser to retrieve the most recent version of this tidy installer.

    I'm writing a perl script using Commands::Guarded to automate what I did in the first article.

    You may retrieve the source with wget, so:
    $ wget -r http://colliertech.org/svn/genDocbook
    

    Or subversion, so:
    $ svn co svn://colliertech.org/genDocbook
    

    You may also get the most recent version of the individual files in the distribution using your favorite











      [Read more...]
    Docbook XHTML generation with tidy, chapter the first
    +0 Vote Up -0Vote Down
    So I'm getting the new version of the MaxDB FAQ ready for production. We used Microsoft Word to create the document and manage corrections. And then I exported to HTML. Word did a terrific (note that the root word here is "terror") job of translating to HTML, and Tidy won't touch it unless I fix some issues manually.

    So here I go.

    Getting most recent build from cvs:

    $ cd ~/src/
    $ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/tidy login
    $ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/tidy co tidy
    


    Building said code:

    $ cd tidy/build/gmake
    $ make
    
    ld: archive: ../../lib/libtidy.a has no table of contents, add one with ranlib(1) (can't load from it)
    make: *** [../../bin/tidy] Error 1
    
    $ ranlib ../../lib/libtidy.a
    $ make
    


    Running code:

    $ cd ../../bin
    $ ./tidy -h
    $ open














      [Read more...]
    Showing entries 1 to 14

    Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.