Lots of other functions have been deprecated, including split(), ereg(), etc. See PHP 5.3 Manual, Deprecated Features.
Upgrading Zend Server from PHP 5.2 to PHP 5.3
Backup your php.ini file. Then run the following commands:
yum remove php-*
yum remove mod-php-*
yum install zend-server-php-5.3
After this, you will need to restore back the settings of your php.ini file.
Hiding Deprecated Warnings
Set your error_reporting to
error_reporting(E_ALL & ~E_DEPRECATED);
Tue, 31 Aug 2010 11:23:40 -0400
The fine art of application virtualization
The new 8-core Intel Xeon 7550 processors are extremely powerful and a good platform for virtualised applications. My company is setting up PHP application running on a Xen based virtualisation on two HP Proliant DL580 for a total of 64 cores in a high availability environment. .
Why Virtualise?
First let's investigate why virtualisation is attractive. The advantages are:
- Simplified maintenance, as all software is running on virtual machines (VMs). Easy to stop and start VMs from the VM server console.
- High availability is easier to achieve, as you can just restart the VM on a secondary server if the primary server fails, assuming that the VM is stored in shared storage accessible by all servers, using shared storage methods such as NFS, iSCSI or a SAN (Storage Area Network).
- Able to optimize server hardware utilisation globally as CPUs, memory, hard disk, network resources are all shared.
The disadvantages are strangely enough related to the advantages:
- The maintenance is simplified, but the initial setup is more complex as not merely do you need to setup the hardware and the operating systems, but you have to plan out the virtual environment, such as the virtual network, and make sure that everything is properly sized as you are buying a few big machines, instead of lots of smaller servers.
- High availability means you need to invest in high quality shared storage to store the shared VMs, typically a SAN, the SAN switches and the Fibre Channel HBA cards to connect to the SAN switches.
- Need to over-configure the hardware as there is some overhead in virtualisation, particularly in terms of network I/O and storage I/O. CPU overhead for virtualisation is normally not a concern with modern virtualisation technologies such as VMWare, Xen, or Hyper-V.
In this case, our customer was comfortable with virtualisation, as they are big users of IBM AIX Logical Partitions and VMWare. Secondly, they already operate several large Storage Area Networks, and merely had to upgrade the SAN to support us. Lastly they had the budget to pay for all of this :)
VM Technology
We are using Zend Server CE (PHP 5.2), Apache 2.2 and Oracle 11gR2 running on Red Hat Linux 5.5 and Oracle VM 2.2 (which uses the Xen Hypervisor).
In the VM world, there are 4 main technologies that are popular:
- VMWare - the market leader, this company has been doing virtualisation for over 10 years and they have good products.
- Xen Based products - Xen is an open source technology that arose from some research on Hypervisors (the bare metal OS that controls all the virtual machines) done in Cambridge University. Today, several companies offer products using Xen, including Red Hat, Citrix, and Oracle. Has good support for Linux and Windows.
- KVM - many kernel hackers were dissatisfied with Xen (because the Xen Hypervisor is not Linux-based internally), resulting in the development of KVM, which is fully Linux based. KVM is not as mature as Xen, but improving really fast. Support Linux and Windows.
- Hyper-V - Microsoft's virtualisation technology. Microsoft is committed to supporting Linux also.
We chose Oracle VM (Xen) because it has good performance with Linux and Oracle databases (naturally). Oracle VM is free with optional paid support available. There are also licensing advantages to using Oracle VM with Oracle databases. Oracle database licensing dictates that if you are using virtualisation technologies such as VMWare and are purchasing CPU licenses, you still have to pay database licenses for all the CPU cores of the server, even if the database VM is using only 1 core. However if you are using Oracle VM, then you only have to pay for the CPU cores you use using; this is known as "hard-partition" licensing in Oracle terminology.
I also have experience with VMWare, and can recommend it as an mature alternative. Apparently the Citrix Xen Server is a good product, but I don't have experience with it.
I will cover more technical details in part 2, which i will be writing in September after I complete this installation.
Fri, 06 Nov 2009 02:52:50 -0500
Updated Optimizing PHP Article
I have just updated my popular Optimizing PHP article with additional information on caching. I discuss memcache and squid. I also updated the PHP Accelerators and changed the tone of some parts of the article. I quote:
Perhaps the most significant change to PHP performance I have experienced since I first wrote this article is my use of Squid, a web accelerator that is able to take over the management of all static http files from Apache. You may be surprised to find that the overhead of using Apache to serve both dynamic PHP and static images, javascript, css, html is extremely high. From my experience, 40-50% of our Apache CPU utilisation is in handling these static files (the remaining CPU usage is taken up by PHP running in Apache).
It is better to offload downloading of these static files by using Squid in httpd-accelerator mode. In this scenario, you use Squid as the front web server on port 80, and set all .php requests to be dispatched to Apache on port 81 which i have running on the same server. The static files are served by Squid.

Sun, 25 Oct 2009 09:12:02 -0400
Malaysian FOSS Conference 2009 Opening Keynote
Last Saturday, I gave the opening keynote of the Malaysian Free & Open Source Software 2009 conference. The speech was prepared the day before, but as usual, I will improvise some stuff, so some parts have been amended based on memory:
Ladies and gentlemen, honored guests, good morning!
Today the landscape of information technology has been transformed by the vision of free software and open source. The search engines of Google roar with the sounds of open source Linux. Our Malaysian government encourages the use of open source whenever possible. Sounds of PHP, MySQL, Apache, GPL have become familiar names in the tapestry of IT.
But that was not what it was like when I first started out as a young student in the mid-80s at the University of Melbourne, Australia. Things were different then. Concepts such as open source, GPL were still unknown. I still remember a fellow student was expelled from university for making copies of the source code of proprietary Unix software for his personal use.
I admit I was disturbed by this, because I too had an insatiable curiosity about how software worked, and it was impossible to learn more without access to the source code. I wanted to find and understand the wiring inside the software.
I remember fondly, and today with a bit of guilt, that I used to crack copy protected games, not for the pursuit of profit, but as an intellectual challenge – well ok, I have to admit I did it to play the games. The trick doing this (cracking) metaphorically is finding the wiring behind the copy protection and reversing the wires so that instead of refusing to run, it does the opposite and continues working.
Of course to quickly find the right wires to switch and crack a large program is not easy. Which brings me to the first piece of advice if you want to be successful in software design… You need to have good taste, which is kind of weird because nerdy programmers are notoriously bad dressers, fond of bad hair days and certainly not fussy about the finer points of fine dining.
What I’m taking about is of course is a taste for good logic. The feel of a beautiful idea, the taste of a mighty logic, or the fun in a great hack.
Games designers and coders are a talented bunch of people, and if you understand their logical rhythms and designs, it becomes obvious where the wires you need to reverse to crack the software reside.
The other important element of success is being happy. You have to have passion and enjoy what you are doing. To me cracking games was like cracking walnuts, a fun thing to do, but after a while it got boring. You need to do something with others and share with others to become really passionate about something.
Social responsibility is another important element of life. You need to channel your life productively - only then will you find true happiness. Cracking games became boring and I found other better diversions.
It was around this time my fellow student was expelled that I learned about the international USENET community. To young people, you have to imagine a time before the World Wide Web, when people used the Internet primarily for email. USENET was a fantastic group of mailing lists with forums and archives. USENET was also used to disseminate programming ideas and knowledge in the form of source code.
So even before the concepts of Open Source and licenses such as GPL became well known, there was this thriving community of programmers who shared their source code and learnt from others. Which brings me to the next lesson: the typical image of the best programmers being lonely introverted hackers is misleading. People are only successful in a community. Open source software needs to be grown organically and for that you need social skills. The classic example here is of course Linus Torvalds, author of Linux, who has skillfully led the Linux community from its inception.
It was through the USENET that I released software that I had written, including the one that won runner-up for best Australian Macintosh software in 1988 while still a foreign student in Melbourne.
You know, while preparing this speech, at the back of my mind I have always wondered why Malaysia has not had a bigger role in contributing software to the open source community? Was what I achieved due to my overseas education? I was thinking about it last night while writing this speech, and I don't think so: I will tell you why...
Malaysians do not lack ability. I see many smart and interesting people around me here at the conference. And I have seen many sophisticated pieces of software in the commercial world developed by talented teams of Malaysians. English, the language of Science and the Internet, is widely spoken here. However in the open source world, we have many more consumers than contributors.
Is it our education system? Perhaps an over-emphasis on exams it is a contributing factor, but I don’t think that is the main reason. I studied for 12 years in Malaysian state schools, and I survived sane and reasonably intelligent! And exposure to the Internet has made young people more worldly than any previous generation of Malaysians.
After reflecting, I suspect the reason is primarily economic. After college, it is difficult to sustain a living and have the time to contribute meaningfully to an open source project here in Malaysia. There are companies with strong support for open source here, but most companies here see little value in allowing their staff to contribute to open source.
So let’s flash forward from studying Melbourne in the 80’s to working in Malaysia in the year 2000. At that point in time, my company was planning on developing their next generation web application server, called PHPLens. An application server is a professional software framework which makes it easier for programmers to build high quality software modules.
We also wanted PHPLens to support as many databases as possible. That was the reason why we decided to open source our database abstraction library. Contributions from the programming community were encouraged so that we could support more databases.
And as this was the 3rd database abstraction library I had developed in my career, I had some meaningful experience in this area. Other developers liked it and today the library has become very popular world-wide and is in use by thousands of developers.
I have been working with and supporting the ADOdb abstraction library for over 9 years. I can tell you working on open source is sometimes not fun. You work for hours to implement some feature and then the feedback you get is that it’s not very useful. People will disagree with you. You also get cranky people emailing you in broken English to fix their problems urgently. And if you misunderstand them, it just gets worst. To survive, you need to be passionate about your work, really listen to people (which isn’t easy in an email exchange) and be committed to excellence.
I would like to show you now a presentation I did on ADOdb a few years ago. [presentation here]
In closing, I would like to ask how do I think the Malaysian Free & Open Source Software movement can advance further? Actually I think we are doing a good job. I see a lot of local companies have already switched to using Open Office or running Linux, Apache, MySQL, PHP for their web-sites.
As I mentioned before, the real factors we need to look into are still economic, your take-home pay. What we need is more demand for people with the right skills to support this open source infrastructure, and an ecosystem where the pay is attractive.
We need to transition from the idea that “free software is cheap†to “free software is cost-effectiveâ€. There is dignity in work, and people deserve to be rewarded. Thank you.
27 Jan 2012 20:26:06 GMT
nester_nhyda 1.3.1
A simple printer of nested lists
27 Jan 2012 20:17:40 GMT
simplenlp 1.1.1
Simple, multilingual natural language tools.
Wed, 11 Jan 2012 00:00:00 +0000
PGCon 2012 Call for Papers
PGCon 2012 will be held 17-18 May 2012, in Ottawa at the University of
Ottawa. It will be preceded by two days of tutorials on 15-16 May 2012.
We are now accepting proposals for talks. Proposals can be quite
simple. We do not require academic-style papers.
If you are doing something interesting with PostgreSQL, please submit
a proposal. You might be one of the backend hackers or work on a
PostgreSQL related project and want to share your know-how with
others. You might be developing an interesting system using PostgreSQL
as the foundation. Perhaps you migrated from another database to
PostgreSQL and would like to share details. These, and other stories
are welcome. Both users and developers are encouraged to share their
experiences.
For more information, please see the original announcement.
Mon, 26 Dec 2011 00:00:00 +0000
DA-SOFT AnyDAC Winter 2012 (v 5.0.5) released
DA-SOFT Technologies announces the immediate availability of
"AnyDAC for Delphi" Winter 2012, v 5.0.5.
Version Highlights
- PostgreSQL v 9 support (named parameters, anonymous blocks, enums);
- major TADTable and Live Data Window mode optimization;
- Firebird v 3 support (packaged procedures, PSQL functions, identity columns, BOOLEAN data type);
- Firebird COMPUTED BY support;
- Interbase v 6, 7 support;
- Advantage v 8, 9 support;
- SQL Anywhere v 12 support;
- SQLite v 3.7.9 support;
- ElevateDB ODBC support;
- ReportBuilder DADE;
And more. For detailed change log, please, check:
http://www.da-soft.com/anydac/anydac-for-delphi-v-5.0.5.2073-released.html
AnyDAC for Delphi
AnyDAC is an unique set of Universal Data Access Components for developing applications on Delphi, C++Builder and Free Pascal. With its powerful common architecture AnyDAC enables native high-speed direct access to PostgreSQL, Firebird, SQLite, MySQL, MS SQL Server, Oracle, IBM DB2, SQL Anywhere, MS Access, Informix, Advantage Database and more. For complete list of features and availability, please check:
- AnyDAC home - http://www.da-soft.com/anydac/
- AnyDAC shop - http://www.da-soft.com/anydac/order.html
- AnyDAC trial - http://www.da-soft.com/anydac/download.html
AnyDAC Core Features
- Native access to PostgreSQL, Firebird, MySQL, SQL Server, Oracle, SQLite, DB2, InterBase, SQL Anywhere, Informix, Advantage Database and more. Including latest DBMS versions.
- Generic access to any database supported through dbExpress or ODBC data sources.
- Optimized for best possible performance. 2 times faster than dbGo, 25% faster than dbExpress.
- Reach API with 50 Delphi VCL components, including TADConnection, TADTransaction, TADQuery, TADStoredProc, TADTable, TADMemTable.
- Unified API for cross-database access, including unified data type mapping, SQL dialect abstraction, connection aliases.
- First-class support for many database-specific features, including backup, restore, validation, SQL scripting.
- Advanced Data Access Options, including Array DML, Live Data Window mode, full Unicode support.
- Delphi 5 to Delphi XE2, C++ Builder 5 to C++ Builder XE2, Lazarus / Free Pascal on Win32, Win64, Linux32, Linux64, Mac OS X.
- Perfect integration as back-end driver for TMS AdvGrid, RemObjects Data Abstract, Fast Report, C4D kbmMW and more.
AnyDAC Natively Supported Databases
- Workgroup - PostgreSQL, Firebird, MySQL, SQL Anywhere, Interbase, Advantage DB.
- Enterprise - Oracle, SQL Server, IBM DB2, Informix.
- Database in clouds - SQL Azure.
- Desktop - SQLite, Access, Advantage DB, BlackFish SQL, SQL CE.
- Embedded - SQLite, Firebird Embedded, MySQL Embedded, Berkeley DB.
- Bridges - dbExpress, ODBC.
--
With best regards,
DA-SOFT Technologies Team
Mon, 05 Dec 2011 00:00:00 +0000
PostgreSQL 2011-12-05 Cumulative Bug-Fix Release
The PostgreSQL Global Development Group today released updates for all active branches of the PostgreSQL object-relational database system, including versions 9.1.2, 9.0.6, 8.4.10, 8.3.17 and 8.2.23. Users of any of the several affected features in this release, including binary replication, should update their PostgreSQL installations as soon as possible.
This is also the last update for PostgreSQL 8.2, which is now End-Of-Life (EOL). Users of version 8.2 should plan to upgrade their PostgreSQL installations to 8.3 or later within the next couple of months. For more information, see our Release Support Policy.
The features affected by this update include: binary replication and hot standby, GIN indexes, the citext extension, pg_upgrade, window function aggregate sorting, self-referential foreign keys, PL/perl, and general Extension handling. Users of these features should apply the updates right away.
This release contains 52 fixes to version 9.1, and a smaller number of fixes to older versions, including:
- Fix bugs in information_schema.referential_constraints view**
- Correct collations for citext columns and indexes**
- Prevent possible crash when joining to a scalar function
- Prevent transitory data corruption of GIN indexes after a crash
- Prevent data corruption on TOAST columns when copying data
- Fix failures during hot standby startup
- Correct another "variable not found in subplan target list" bug
- Fix bug with sorting on aggregate expressions in windowing functions
- Multiple bug fixes for pg_upgrade
- Change Foreign Key creation order to better support self-referential keys**
- Multiple bug fixes to CREATE EXTENSION
- Ensure that function return type and data returned from PL/perl agree
- Ensure that PL/perl strings are always UTF-8
- Assorted bug fixes for various Extensions
- Updates to the time zone database, particularly to CST6
Changes marked with ** above require additional, post-update steps in order to fix all described issues. See the release notes for each version for a full list of changes with details of the fixes and steps.
As with other minor releases, users are not required to dump and reload their database or use pg_upgrade in order to apply this update release; you may simply shut down PostgreSQL and update its binaries. Perform post-update steps after the database is restarted.
Download new versions now:
Sun, 27 Nov 2011 00:00:00 +0000
www.postgresql.org migrated to new framework
The code behind www.postgresql.org has been migrated to a new technology framework. The site itself should work exactly as before, but the user experience will be slightly different.
All the data from the previous website has been migrated over, but some of it requires manual adjustments to look correct. We ask for your patience as we finish this process over the upcoming days.
For those who regularly submit news and events to the site, you will notice that the process has changed. In this process there are also some manual steps involved to migrate your permissions in the system - so again, we ask for your patience.
Wed, 09 Nov 2011 00:00:00 +0000
Gazzang now supports Postgres for ezNcrypt
Gazzang, Inc., the company securing data in the cloud, today announced availability of packaged support for PostgreSQL 8.x and 9.x open source databases in its ezNcrypt flagship data security platform. The release adds Gazzang’s Transparent Data Encryption for PostgreSQL to existing support for MySQL databases, and is now available for download.
Gazzang ezNcrypt for Databases enables customers to protect, encrypt and provide key management for open source databases using transparent data encryption features traditionally reserved for more expensive, complex commercial databases. The solution installs within minutes, providing out-of-the-box data protection that eliminates the need for costly, complex changes to databases and applications, and leveraging an advanced key management system where the keys are never stored on the same server with the data to be encrypted.
Read more on the Gazzang Blog
OpenXcom 0.3 (new)
Open-source reimplementation of the original X-Com
More about OpenXcom
Hedgewars 0.9.17 (updated)
Worms clone
More about Hedgewars
xboxdrv 0.8.4 (updated)
Userspace XBox/XBox360 Gamepad Driver
More about xboxdrv
Fri, 27 Jan 2012 00:00:00 EST
Texas Students to Speak Live With Space Station Crew
Fifth- through eighth-grade students at Asa Low Intermediate School in Mansfield, Texas, will speak with NASA’s Expedition 30 Commander Dan Burbank and Flight Engineer Don Pettit aboard the International Space Station at 11:50 a.m. EST on Tuesday, Jan. 31.
Fri, 27 Jan 2012 00:00:00 EST
Astronaut Jerry Ross, First Seven-Time Flier, Retires
Jerry Ross, the first person to launch into space seven times, has retired from NASA. In a career that spanned more than three decades, Ross spent almost 1,400 hours in space and conducted nine spacewalks to rank third on the list of most extravehicular activity time in space.
Thu, 26 Jan 2012 15:56:12 -0600
Melelang Burung Beo dengan Harga Mahal
Suatu hari seorang pria pergi ke balai lelang untuk sebuah penawaran pada seekor burung beo. Dia terus kalah dalam menawar, jadi dia meneriakkan tawaran yang lebih tinggi dan lebih tinggi dan lebih tinggi. Akhirnya, setelah tawaran menjadi sangat tinggi, dia memenangkan lelang - beo itu akhirnya menjadi miliknya!
Ketika ia membayar burung beo, ia berkata kepada pimpinan lelang, "Saya sangat berharap burung beo ini dapat berbicara. Aku benci harus membayar banyak untuk ini, hanya untuk mengetahui bahwa dia tidak bisa bicara!"
"Jangan khawatir," kata pimpinan lelang, "Dia bisa bicara. Menurut Anda, siapa sih yang terus menawar tinggi melawan Anda tadi?" (KETAWA.COM)
Wed, 25 Jan 2012 16:09:39 -0600
Anjing Pintar Main Poker
Dua pemilik anjing itu membual tentang kecerdasan hewan peliharaan mereka. "Anjing tercerdas yang pernah saya miliki," kata salah satu, "adalah Great Dane yang bisa bermain kartu. Dia hebat di poker, namun akhirnya seorang teman mengeluh tentang dia dan saya harus menyingkirkannya."
"Kau menyingkirkannya? anjing pintar seperti itu?" seru temannya. "Seekor anjing seperti itu akan bernilai jutaan dolar!"
"Seharusnya sih," jawab pria pertama. "Tapi dia ketahuan bermain curang..." (KETAWA.COM)
Tue, 24 Jan 2012 16:09:27 -0600
Anjing Menggonggong Tidak Seperti Biasanya
Seekor anjing yang biasanya tenang mulai menggonggong setiap malam sekitar pukul 03:00. Kesal dan mengantuk, pemilik anjing menggeledah halaman belakang untuk mengetahui apa yang mungkin mengganggu kedamaian hewan ini.
Selama tiga hari ia tidak menemukan sesuatu yang salah. Ketika anjing bangun di malam yang keempat pada pukul 3 pagi sambil menggonggong, pemilik akhirnya menyelinap di sekitar rumah melalui gang dan menemukan tetangga melempar kerikil pada si anjing.
Pemilik bertanya untuk mengetahui apa yang ia lakukan.
"Ibu mertua saya berkunjung," tetangga sambil malu menjelaskan. "Jika dia sampai terbangun di tengah malam sekali lagi dia mengatakan bahwa dia akan pergi..." (KETAWA.COM)
Mon, 23 Jan 2012 16:09:17 -0600
Daging Tumbuh di Mulut Anjing
Seorang pemilik anjing yang putus asa menelepon dokter hewan memohon untuk segera bertemu. Dia menjelaskan bahwa anjingnya memiliki bengkak besar dekat sudut mulutnya semacam daging yang tumbuh dalam semalam, sehingga si dokter hewan mengatakan kepadanya untuk membawa hewan tadi ke kliniknya.
Ketika orang itu datang dengan anjingnya, dokter hewan memeriksanya, sedangkan si pemilik anjing berdiri, cemas menunggu pendapat dokter hewan. Akhirnya dokter
berpaling kepadanya dan bertanya, "Apakah Anda punya anak?"
"Ya ampun, apakah itu menular?" pria itu terkejut.
"Tidak," jawab dokter hewan. "Ini permen karet." (KETAWA.COM)
Sun, 22 Jan 2012 16:07:39 -0600
Menurunkan Anjing Bermata Juling
Seorang pria membawa Rottweiler ke dokter hewan. "Anjing saya juling, apakah ada sesuatu yang dapat Anda lakukan untuknya?"
"Baiklah," kata dokter hewan, "mari kita lihat dia."
Jadi ia mengangkat anjing itu dan melihat matanya baik-baik saja.
"Yah," kata dokter hewan, "Aku harus menurunkannya."
"Kenapa? Karena dia bermata juling??"
"Tidak, karena dia sangat berat!" (KETAWA.COM)
Wed, 25 Jan 2012 00:59 GMT
GE Proficy Historian ihDataArchiver.exe Trusted Header Size Code Execution Vulnerability
This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of GE Proficy Historian.This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of GE Proficy Historian.
-
Make your website safer. Use external penetration testing service. First report ready in one hour!
Wed, 25 Jan 2012 00:59 GMT
HP Data Protector Notebook Extension LogClientHealth SQL Injection Vulnerabilty
This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of HP Data Protector Notebook Extension.This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of HP Data Protector Notebook Extension.
-
Make your website safer. Use external penetration testing service. First report ready in one hour!
Wed, 25 Jan 2012 00:54 GMT
HP Data Protector Notebook Extension LogCopyOperation SQL Injection Vulnerabilty
This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of HP Data Protector Notebook Extension.This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of HP Data Protector Notebook Extension.
-
Make your website safer. Use external penetration testing service. First report ready in one hour!
Thu, 12 Jan 2012 14:07:00 GMT
Chris Hardy: Speaking events for 2012
Hello all, It's the start of a new year and what better way to start the year off than to announce a few session that I will be presenting at a few conferences and user groups in the next 6 months, it would be great if you could come along! 1st Feb; Canary...(read more)
Thu, 12 Jan 2012 11:25:00 GMT
Jb Evain: Mono.Linq.Expressions update 2
This is the second part of an update about Mono.Linq.Expressions, a tiny helper library to complement the System.Linq.Expressions namespace for .net 4 and Mono.
The first part is about fluent creation of expression trees.
Combining expression trees together
I keep reading questions on StackOverflow about this. How to combine two lambda expression together? If we have:
Expression<Func<User, bool>> isUserOver18 = u => u.Age >= 18;
Expression<Func<User, bool>> isFemaleUser = u => u.Gender == Gender.Female;
If we want to combine this lambda expression with a ?and? logical expression, the natural way would be to write:
Expression<Func<User, bool>> isFemaleUserOver18 = u =>
isUserOver18(u) && isFemaleUser(u);
This works just fine if you compile the expression into a delegate to actually execute this code. But most of the time questions of StackOverflow are about using the resulting lambda expression to create a query for LINQ to a database provider, which will analyze the expression tree and create an according SQL request.
By combining expression trees this way, the LINQ provider may or may not be unable to turn the two invocations into actual SQL.
That's one of the reason I wrote about an updated PredicateBuilder. The obvious solution is to inline the two combined representation of lambda expressions into a new lambda expression tree.
The update of Mono.Linq.Expressions comes with a new type, CombineExtensions, which exposes extension methods that you can use to combine fully created (into lambda expressions) expression trees.
Using those, combining the two expression trees is as simple as:
Expression<Func<User, bool>> isFemaleUserOver18 = isUserOver18.Combine(
isFemaleUser,
(left, right) => left.AndAlso(right));
And indeed, if you print the code representation of this expression tree, you'll have both lambda bodies inlined into another one:
user => user.Age >= 18 && user.Gender == Gender.Female
Or if you want to negate the boolean expression:
Expression<Func<User, bool>> isNotFemaleUserOver18 = isFemaleUserOver18.Combine(
e => e.Not());
The cool thing about those Combine extension methods is that they're completely generic, they don't work only on simple predicates. For instance, you can use those to chain constructions of mathematical expressions.
Wed, 11 Jan 2012 16:00:00 GMT
Jb Evain: Mono.Linq.Expressions update
I just tagged the 1.2 version of Mono.Linq.Expressions, and pushed an updated nuget package.
Mono.Linq.Expressions is a utility library to complement the System.Linq.Expressions namespace, and works with .net 4.0 just as fine as it does with Mono. With a bit over 220 downloads of the nuget package, it's short of roughly 160,400 downloads to be the most downloaded nuget package : a stunning success to put it simply.
This post is the first of a short series to detail what's awesome and new in this version.
Extension methods for a fluent construction of expression trees.
Have you been using the expression tree API to build a representation of code at runtime ? If so you're familiar with the Expression class, and it's load of factory methods.
You're also familiar with this kind of code:
var user = Expression.Parameter(typeof (User), "user");
var isFemaleUserOver18 = Expression.Lambda<Func<User, bool>>(
Expression.AndAlso(
Expression.GreaterThanOrEqual(
Expression.Property(user, "Age"),
Expression.Constant(18)),
Expression.Equal(
Expression.Property(user, "Gender"),
Expression.Constant(Gender.Female))), user);
If you take some time to parse this code, the intent is to create an expression tree similar to the one the compiler would emit if you were to write:
Expression<Func<User, bool>> isFemaleUserOver18 =
user => user.Age >= 18 && user.Gender == Gender.Female;
Mono.Linq.Expressions 1.2 contains a code generated series of extension methods to simplify the manual construction of expression trees by fluently chaining the invocations. This allows you to write instead:
var user = typeof (User).Parameter("user");
var isFemaleUserOver18 = Expression.Lambda<Func<User, bool>>(
user.Property("Age").GreaterThanOrEqual(18.Constant())
.AndAlso(
user.Property("Gender").Equal(Gender.Female.Constant())), user);
Not only is the code shorter, but it's also easier on the eyes, and easier to comprehend. Using this, almost the factory methods calls to the Expression class can be written fluently.
2012-01-27T17:43:46+00:00
Ekkehard Gentz: mobile development – my next sessions + events
here’s an overview of my upcoming sessions and events and I would be glad to meet you there:
M-Days – Frankfurt, 2012-02-01: Location Based Services

At the Mobile Days in Frankfurt I’m talking about Location Based Services. In many of my customer projects I’m using Location Based Services, have integrated Maps, track GPS etc. I’ll talk about good practices, tips and tricks and demonstrate some of my work. You’ll find me at Developer Stage 1 on Wednesday 2012-02-01 at 13:00.
In the night I’ll also attend the Mobile Media Night
At M-Days I’ll first time use my new Camholder from Heiko Behrens (@HBehrens) – will later blog about my experiences with heikos awesome new product.
BBDevCon Europe – Amsterdam, 2012-02-08: SuperApps

Only some days later I’ll speak at BlackBerry Developer Conference about developing Super Apps. I’m happy to meet some friends again and looking forward to get the newest informations about BB10 – the future OS for BlackBerry.
Mobile Developer Conference – HH, 2012-02-15: Push Services

More and more mobile applications are using Push Services. Unfortunately there’s no common API and so you have to know the differences and what’s possible on the different platforms. I’ll talk about PushServices for Apple, Google, Microsoft and RIM.
Mobile Tech Con 2012 – Munich 2012 – 2012-03-29: Power Workshop Cascades

Next MobileTechCon is in Munich – not far from Rosenheim, where I work and live. I’ll present a full-day Power Workshop about the new UI Framework Cascades from RIM. With Cascades you can write great apps in a short timeframe with awesome animations. Designers and Developers can work hand-in-hand: a PlugIn for Photoshop allows you to easy move graphical work and drag it into your QML Editor. Cascades is one of te reasons why I as a developer am sure, that RIM will came back in 2012. Using Cascades you can develop Applications for PlayBook 2.x and also upcoming BB10.
EclipseCon America 2012

Unfortunately this time I cannot travel to EclipseCon America, because exactly same week there’s MobileTechCon in Munich.
But of course I’m developing the BlackBerry Conference App for EclipseCon 2012 and hope that the timing is better next year.

—————————————————————————————————————————

(c) 2012 Creative Commons License 3.0 (BY-NC-SA) by ekkescorner
Filed under: Blackberry, EclipseCon, mobile
2012-01-27T15:57:33+00:00
Birt World: BIRT Runtime Addition
As part of the 3.7 release BIRT now uses a BIRT POJO runtime. This change was described in the BIRT 3.7 New and Notable. If you are using a version of BIRT prior to 3.7 be sure to check out the Migration Guide. As part of the 3.7.2 release of BIRT which will be released in a couple of weeks, the team has decided to release a second runtime that uses the OSGi runtime. This new download will function similar to the BIRT runtime prior to BIRT 3.7 and is available on the full downloads page. You can try out the 3.7.2 release candidate version of this download by selecting the release candidate on the recent builds page.

2012-01-27T04:22:36+00:00
Ian Skerrett: Dev + Ops = Getting Software Deployed Faster (DevOps)
DevOps is one of those terms you hear a LOT about lately but I am not sure it is really well understood. However, if you are going to be successful at Agile ALM it would seem natural you would want to bring the operations side of IT closer into the development process. Puppet is one example of an open source project that is implementing some of the DevOps concepts.
When we put together the program committee for Agile ALM Connect we specifically wanted an expert from the DevOps community to make sure the program had a healthy devops slant. Therefore, I was thrilled to have Lukes Kanies, the founder of Puppet and CEO of PuppetLabs, agree to be on the program committee and also speak at Agile ALM Connect on ‘what is devops’ and introduce Puppet. We will also have Kenn Hussey talk about Geppetto, an Eclipse-based Puppet IDE.
In my Q&A series with Agile ALM Connect speakers, Luke answered three questions about DevOps.
1. ‘DevOps’ is a term that is used quite a bit lately. How do you describe the term DevOps and why should developers care?
DevOps is in to operations what Agile is to development. Operations needs to be a competitive advantage, adopting new technology quickly and with minimal business interruption, but in many cases the business goals have been lost and the new focus on policy and compliance has allowed IT to become a cost center. DevOps is about operations teams working closely with everyone involved in product delivery to make sure that business needs come first. This often involves a lot of automation, but the main thing is about making sure the customer comes first, just like in agile development.
Developers should care because organizations following devops practices will do a better job of supporting them, getting their software deployed faster and more easily.
2. You are the founder of the Puppet open source project. Why did you start Puppet?
When I started Puppet, the tools and practices in IT had barely changed in ten years. I was afraid that it would still not have changed in ten more years, and I saw an opportunity to build a better tool and help make the lives of sysadmins better. Based on how passionate our user base, we seem to have struck a chord.
3. What advice do you have for people that want to learn how to use Puppet?
First, start small, and fix the most painful things first. Trying to boil the ocean by automating your whole infrastructure will just frustrate you and have little reward, but if you start by automating the small, menial work in your infrastructure you’ll have quick rewards and, even better, more time available in your day to work on the hard and important stuff.


powered by zFeeder