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ł!

This Week in Web – PHP COM, Pango, Python32, Titanium Mobile

This Week in Web – PHP COM, Pango, Python32, Titanium Mobile

PHP Pango Extension

Michael Maclean has recently published a PHP wrapper for the Pango library. It depends on his Cairo PECL package as well as Pango. Once installed you can draw graphics with Cairo and text with Pango directly from PHP. The following code is taken from his announcement:

header("Content-Type: image/png");
/* Make a 300x300px image surface */
$s = new CairoImageSurface(CairoFormat::ARGB32, 300, 300);
$c = new CairoContext($s);

/* Set the background to white */
$c->setSourceRGB(1, 1, 1);
$c->paint();

/* Let's draw using black 'ink' */
$c->setSourceRGB(0, 0, 0);

/* Make a Pango layout, set the font, then set the layout size */
$l = new PangoLayout($c);
$desc = new PangoFontDescription("Bitstream Charter 28");
$l->setFontDescription($desc);
$l->setWidth(250 * PANGO_SCALE);

/* Here, we use Pango markup to make part of the text bold */
$l->setMarkup("Hello world! Here is a rather long paragraph which should get wrapped");

/* Draw the layout on the surface */
$l->showLayout($c);

/* Output the PNG to the browser */
$s->writeToPng("php://output");

Titanium Mobile 1.6 Released

Appcelerator have just announced the release of version 1.6.0 of their Titanium Mobile SDK. 1.6.0 includes many new features for the Android platform including additional Intents, Samsung Galaxy support and the option that allows the app to be installed directly to the SD card. It also greatly reduces the filesize of the final .apk package of your application. Under the 1.5 SDK a simple app I created was 3.2mb, repackaged with the 1.6 SDK it was only 1.1mb. Note that this version of Titanium Mobile SDK marks Android 1.6 as deprecated. Over the next few weeks Query7 will be featuring a series of tutorials on creating mobile apps with Titanium Mobile.

Using COM in PHP

Justin Martin recently wrote a tutorial titled Using the Windows COM in PHP. In it he describes what the COM (Common Object Model) is and how useful it can be to interact with applications or the Windows operating system. If you run PHP on windows and are interested in using it as a scripting language for your computer I highly recommend you read this article. The following snippet (taken from Justin Martin’s blog) shows how you can change the desktop background using PHP and COM.

RegRead('HKEY_CURRENT_USERControl PanelDesktopWallpaper');
echo "{$currentWallpaper}n";  

$registry->RegWrite('HKEY_CURRENT_USERControl PanelDesktopWallpaper', 'C:Documents and SettingsYourUserLocal SettingsApplication DataMicrosoftYourWallpaper.bmp');
?> 

Python 3.2 Released

Since PEP 3003, the Moratorium on Language Changes, is in effect, there are no changes in Python’s syntax and only few changes to built-in types in Python 3.2. Development efforts concentrated on the standard library and support for porting code to Python 3.

Some of the highlights are:

  • an overhauled GIL implementation that reduces contention
  • an extended email package that handles bytes messages
  • a much improved ssl module with support for SSL contexts and certificate hostname matching
  • a sysconfig module to access configuration information
  • additions to the shutil module, among them archive file support
  • many enhancements to configparser, among them mapping protocol support
  • improvements to pdb, the Python debugger
  • countless fixes regarding bytes/string issues; among them full support for a bytes environment (filenames, environment variables)
  • many consistency and behavior fixes for numeric operations

Get Python 3.2

Django and Python3 – Take 2

Django core developer Alex Gaynor has written a blog post about Python 3 support for Django. He is hoping that it will be picked up as a project for the 2011 Google Summer of Code. It will be great news for the Python community if it does get accepted into GSOC as alot of people want to develop Python 3 apps using Django.

Source: http://query7.com/this-week-in-web-php-com-pango-python32-titanium-mobile

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

Posted Luty 26th, 2011 in WEB and PHP Development.

Leave a response: