Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Archive for Marzec, 2011

php|architect: Looking for a simpler MySQL library? Try MeekroDB

php|architect: Looking for a simpler MySQL library? Try MeekroDB

On the php|architect site today John Mertic has a new post looking at a simpler MySQL library – MeekroDB.

I remember fondly back in the day, when PHP 4.0 was all the rage, that if you wanted to interface with MySQL there was one choice: the PHP mysql extension. Then came database abstraction layers ( such as ADODB and PEAR_DB ) and newer extensions ( namely PDO and mysqli ), all with the goal of simplifying the code needing written to be able to get data successfully out of a database. But even then, it still could get a bit complex. Fortunately, someone saw this and wrote a library to make it even simpler. This library is MeekroDB.

A bit of code is included, comparing the MySQLi version of how to connect, create a query, bind some parameters and make the request to fetch the results to the MeekroDB version (compressed down and including a handy method queryFirstField). You can find out more about MeekroDB in its documentation.

Source: http://www.phpdeveloper.org/news/16110

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Stuart Herbert’s Blog: Dealing With PEAR Dependency Quirks

Stuart Herbert’s Blog: Dealing With PEAR Dependency Quirks

Stuart Herbert has a new post to his blog today that shares some helpful hints about dependency quirks that can come with using PEAR packages and the PEAR installer.

To save myself a bit of effort, I thought it would make sense to make my API client reuse PEAR’s existing HTTP_Request2 component. No sense in re-inventing the wheel, I thought. But that’s where my troubles began. [...] There are a few quirks in the way that the PEAR installer handles version numbers, and you need to know how to deal with them if you’re going to re-use PEAR project components in your own apps.

He shows how a dependency can be set up for the HTTP_Request2 package as a part of the update to his project. He talks about changes to the project’s package.xml file and the trick with version numbering to get the latest. In this case, the latest is a non-stable alpha/beta component and the package.xml file needs some special handling to cooperate there (version, stability, release, api and min/max).

Source: http://www.phpdeveloper.org/news/16109

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Titanium Mobile Android Development: Device Information

Titanium Mobile Android Development: Device Information

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial walks you through developing and packaging an application which shows information about the device the app is running on. Full source and packaged application is available on github.

The Application

The application will show the following pieces of information:

  • Hardware name (HTC Desire, Samsung Galaxy)
  • Free RAM
  • Connection to the internet (Not connected, Wifi, Mobile)
  • MAC Address
  • CPU Architecture
  • Android version

The User Interface

The user interface is made up of one Window and seven Labels.

The Application

The application displays many instances of Titanium’s Label class. We apply some basic styling such as the height of the label, distance from the top of the window, color and font size. We get all the system information we need through the Titanium.Platform and Titanium.Network classes. Note that if we didn’t set a top attribute on each label then they would all appear one on top of the other. After instantiating the Window and Labels we need to attach each label onto the instance of Window so that they are displayed. This is done using the add method on the instance of Window.

Resources/app.js

Titanium.UI.setBackgroundColor('#000');

var window = Titanium.UI.createWindow({
    title:'Query7 Device Information',
    backgroundColor:'#F3F1E9',
});

var label_title = Titanium.UI.createLabel({

    height:40,
    top:0,
    left:0,
    width: '100%',
    backgroundColor: '#3F464F',
    color: '#F3F1E9',
    textAlign: 'center',
    text: 'Query7 Device Information',

});

var label_platform_name = Titanium.UI.createLabel({

    height: 40,
    top:50,
    color: '#31363E',
    font: {fontSize:15},
    text: 'Device: ' + Titanium.Platform.model,

});

var label_memory_usage = Titanium.UI.createLabel({

    height:40,
    top:100,
    color: '#31363E',
    font: {fontSize:15},
    text: 'Free RAM: ' + Math.round(Titanium.Platform.availableMemory / 1024) + 'mb',

});

if(Titanium.Network.online)
{
    text_internet_status = 'Internet via ' + Titanium.Network.networkTypeName;
}
else
{
    text_internet_status = 'No Internet Access';
}

var label_internet_status = Titanium.UI.createLabel({

    height:40,
    top:150,
    color: '#31363E',
    font: {fontSize:15},
    text: text_internet_status,

});

var label_mac_address = Titanium.UI.createLabel({

    height:40,
    top:200,
    color: '#31363E',
    font: {fontSize:15},
    text: 'MAC Address: ' + Titanium.Platform.macaddress,

});

var label_cpu_info = Titanium.UI.createLabel({

     height:40,
     top:250,
    color: '#31363E',
    font: {fontSize:15},
    text: Titanium.Platform.ostype + ' CPU',

});

var label_version = Titanium.UI.createLabel({

    height:40,
    top:300,
    color: '#31363E',
    font: {fontSize:15},
    text: 'Android: ' + Titanium.Platform.version,

});

window.add(label_title);
window.add(label_platform_name);
window.add(label_memory_usage);
window.add(label_internet_status);
window.add(label_mac_address);
window.add(label_cpu_info);
window.add(label_version);

window.open();

Updating Free RAM

While our application is running the level of available memory will constantly be changing. We can easily update the level of Free RAM displayed in our application using the Javascript function setInterval(). As shown below, we reassign the text attribute of label_memory_usage (which was set above) every 120 milliseconds.

setInterval(function()
{
	label_memory_usage.text = 'Free RAM: ' + Math.round(Titanium.Platform.availableMemory / 1024) + 'mb'
},120);

Packaging

Every time you test your application in the Android emulator, a local unsigned package of your application is created. You can copy this .apk from path/to/app/build/android/bin/ directly on to your mobile device to see how your app handles. This is fully useable. However if you intend to publish your application onto the Android Market then read how to sign and package your application here.

If you have any comments, questions or requests for tutorials, please ask below.

Source: http://query7.com/titanium-mobile-android-development-device-information

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Chris Jones’ Blog: Building PHP 5.3 with Oracle HTTP Server 11g

Chris Jones’ Blog: Building PHP 5.3 with Oracle HTTP Server 11g

The latest post on Chris Jones’s blog walks you through the process, step-by-step, of how to build PHP 5.3 with support for the Oracle HTTP server included with the 11g version of the database.

I get the impression that not a lot of people in the PHP community are using Itanium. There are enough warnings during PHP compilation that would make me extremely uncomfortable using it for production applications. A PHP on Itanium installation bug that I logged long ago has not been patched, indicating to me that not many PHP people are investing time in the platform. I can’t recommend using Itanium platform for PHP. Anyway, I had a need and here are the steps for posterity.

It’s a pretty simple process (if you’re used to compiling your own software):

  • Checks the OS and compiler to ensure needed tools are installed
  • Set up the Oracle environment variables
  • Set up the PHP environment
  • Copy over the needed header files
  • Extract PHP and modify its configure slightly
  • make distclean and then configure

Source: http://www.phpdeveloper.org/news/16097

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Maarten Balliauw’s Blog: Windows Azure and scaling: how?

Maarten Balliauw’s Blog: Windows Azure and scaling: how?

In a recent post to his blog Maarten Balliauw (the third part of a series) looks at how you can use Azure to scale your PHP-based application dynamically using the latest version of the Windows Azure SDK for PHP. His example creates a simple shell script that can scale up or down your instances with one call.

One of the key ideas behind cloud computing is the concept of scaling.Talking to customers and cloud enthusiasts, many people seem to be unaware about the fact that there is great opportunity in scaling, even for small applications.

Using the SDK, he shows how to create the command-line tool buy craeting a management client and setting up the command line parameters to give to the setInstanceCountBySlot() method. This gives you the ability to spawn off as many new “slots” (instances) as you might need quickly and easily.

Source: http://www.phpdeveloper.org/news/16096

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Community News: Dutch PHP Conference – php|architect Offers Attendees Subscription

Community News: Dutch PHP Conference – php|architect Offers Attendees Subscription

As a part of the sponsorship they’re providing to this year’s event, php|architect will be providing one-year subscriptions to the magazine to all Dutch PHP Conference attendees at this year’s event.

We’re back with more good news! Our friends at php|architect are sponsoring the Dutch PHP Conference 2011 with a sweet deal: they’re offering every attendee a free, one-year subscription to their awesome php|architect magazine! In case you’re not familiar with it, php|architect is a monthly magazine (pdf, epub and mobi version available) that features articles, columns and more awesomeness on PHP.

If you haven’t already gotten your tickets, now is the perfect time – you can get a full conference pass for 595 Euro or either a tutorial-only/conference-only pass for 325 Euro.

Source: http://www.phpdeveloper.org/news/16095

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Kevin Schroeder’s Blog: Planning is underway for ZendCon

Kevin Schroeder’s Blog: Planning is underway for ZendCon

If you’ve ever been to a conference and felt like they missed the target on the topics you wanted to see, Kevin Schroeder, an organizer for this year’s Zend/PHP Conference, is asking for feedback from the community as to what they want to see at this year’s event.

The primary responsibility I have, as being in charge of content is making sure that, well, we have good content. [...] While ZendCon may have the Zend name in it, it is the conference attendees who determine its success. It is whether or not you, as an attendee, are satisfied which determines my success in determining content. That said, I would like your input on what types of topics YOU would like to see. So if you have an opinion on what would make ZendCon compelling for you please leave a comment.

You can voice your opinion by leaving your comment on his post. There’s already some good suggestions and lists for several hot topics around the community right now including deployment practices and community-oriented sessions. The date and the location for this year’s event have not been released yet.

Source: http://www.phpdeveloper.org/news/16094

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Wojciech Sznapka’s Blog: Dynamic LAMP setup for localhost development

Wojciech Sznapka’s Blog: Dynamic LAMP setup for localhost development

In a recent post to his blog Wojciech Sznapka shows you how to set up your local development environment so that you’re not having to configure a VirtualHost (assuming you’re using Apache, of course) each time you want to work on a new project.

If you are developing PHP application on your own PC, you probably have some vhost based configuration of your Apache. With some tricks, you can turn your Linux box into powerful development server without configuring vhost for every app. [..] We can ommit two lasts steps [of a typical setup process], limiting preparation of the environment only to place source code somewhere in filesystem. To achieve this we need mod_vhost_alias module for Apache2 and simple DNS server which will resolve local domain names for us.

His tip uses the mod_vhost_alias module for Apache and the dnsmasq tool to make the basic DNS server to resolve these custom domains. A few configuration changes later (included) and you’re set to restart apache and be on your way.

Source: http://www.phpdeveloper.org/news/16093

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Saltwater.eu: PHP Cloud Management: Orchestra vs. PHP Fog

Saltwater.eu: PHP Cloud Management: Orchestra vs. PHP Fog

From Saltwater.eu today there’s a comparison of PHPFog and Orchestra, two services that offer cloud-based scalable PHP deployments that can happen at the push of a button.

I am evaluating these platforms in order to see if either one can ease my sysadmin burden. Well, so far, as with any cloud service promising the next best thing since sliced bread, I got mixed feelings. For the moment I tested just the free tier of both platforms. While Orchestra uses a pay-as-you-go model, PHP Fog asked for $29/mo in order to drag that number of servers slider. That’s a little bit much for a plain evaluation aka not so cloud-ish model where you don’t need upfront investments.

The reviewer walks through the setup of each side – the server creation and configuration, how things are handled with the load balancer, the caching layer, the application server technology stack, app design considerations and the deployment process.

Source: http://www.phpdeveloper.org/news/16092

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Blast from the Past – One Year Ago in PHP

Site News: Blast from the Past – One Year Ago in PHPHere’s what was popular in the PHP community one year ago today:

Source: http://www.phpdeveloper.org/news/16091

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>