Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Tobias Hermann:
Programming language subreddits and their choice of words
Aug 21, 2014 @ 17:14:13

Tobias Hermann has put together some interesting statistics pulled from the various programming subreddits on the Reddit.com site. He measures the choice of words for each community based on how own they're used.

While reading about various programming languages, I developed a hunch about how often different languages are mentioned by other communities and about the average conversational tones used by relative members. To examine if it was just selective perception on my site, an unconscious confirmation of stereotypes, or a valid observation I collected and analysed some data, i.e. all comments (about 300k) written to submissions (about 40k) in respective programming language subreddits from 2013-08 to 2014-07 using PRAW and SQLite. In this article I will present some selected results.

He first covers the "mutual mentions" for each of the groups with the largest connection from the PHP subreddit being to Python. He also compares the results to the TIOBE index for each (average popularity). He gets into more details about the words used (abstract, category, pure, etc) with PHP placing somewhere roughly in the middle for most data sets. The most interesting result, however, came with the set of curse words and the frequency of their use. In the PHP Reddit community the usage of these terms is, by far, the most of any group. Unfortunately, PHP also ranks lower on the "happiness" scale.

If you're interested in seeing how he came up with these results, you can get the raw results and the code he used.

tagged: programming community language word choice subreddit

Link: https://github.com/Dobiasd/programming-language-subreddits-and-their-choice-of-words/blob/master/README.md

Philip Norton's Blog:
Creating A Thumbnail Of A Word Document With PHP And LiveDocx
Sep 26, 2011 @ 13:50:42

In a new post to his blog Philip Norton shares a method for creating a thumbnail of a Word document with the help of PHP and LiveDocx (in this case, the component inside the Zend Framework).

Creating Word document icons is very simple thanks to a service called LiveDocx. LiveDocx was created as a web service to allow the easy creation of most document formats from a simple template. However, it is possible to send a normal Word document as the template file and get an image of the file in return.

You'll need a LiveDocx account to be able to use the service - there's a free option of their service that uses a shared server. Included in the post is a sample script that defines a LiveDocx connection, pulls in a local Word document for parsing and calls a "getBitmaps" method on the service to return the raw image data. This is pushed into an image (using GD) as a PNG.

tagged: word document livedocx zendframework webservice image thumbnail

Link:

php|architect:
PHPDOCX: generating Word documents from PHP
Jul 22, 2010 @ 15:23:18

On the php|architect blog today there's a new post about a tool that helps you create Word documents directly from your PHP application - PHPDOCX.

PHPDOCX is a PHP library that allows its client code to generate Microsoft Word documents in the .docx format from PHP scripts. PHP is increasingly being used for disparate goals and has to deal with data that comes from strange sources and has to be produced in stranger formats. [...] Starting with the 1.5 version, which has been released on July 12th, PHPDOCX is now compatible with PHP 5.3. The adoption of PHP 5.3 from operating systems is growing and it will at last replace the previous versions of PHP also in the servers of hosting providers.

He mentions some of the features it includes (like the library and automatic insertion of things like headers and footers) as well as two requirements for the tool to work - the zip and xsl extensions.

tagged: generate word document phpdocx

Link:

Thomas Weinert's Blog:
Highlight Words In HTML
May 10, 2010 @ 15:34:24

In the latest post to his blog Thomas Weinert takes a look at a simple challenge someone asked him about - highlighting a section of HTML based on a search string - and his solution.

The challenge is to wrap given words in text content with a span and add a class to the span depending on the word. Do not touch elements, attributes, comments or processing instructions. Do it case insensitive and do it the safe way.

He uses the FluentDOM tool to get the job done. It allows him to create an XPath expression to single out the item to be highlighted (in this case a single or series of words) and wrap them in a matching span tag with the correct styles attached.

tagged: fluentdom tutorial highlight word

Link:

Sameer Borate's Blog:
Porter Stemming algorithm for search
Apr 29, 2009 @ 12:57:06

In a recent post to his blog Sameer looks at implementing a Stemming algorithm to search an array of words. It uses this library (as written by Richard Heyes).

A stemming algorithm lets you reduce each English input word to its basic root or stem (e.g. 'walking' to 'walk') so that variations on a word ('walks', 'walked', 'walking') are considered equivalent when searching. This stems can than be used in a search query rather than the original words, which generally (but not always) results in more relevant search results.

His code example uses the library to search for two different types of strings - a single word and a phrase (with stop words removed). The Stem() method is called on the word and the results are looped through to remove all matching the values in the stop words array.

tagged: stop word search stem root query library richardheyes

Link:

Developer Tutorials Blog:
Extracting text from Word Documents via PHP and COM
Mar 26, 2008 @ 17:02:06

In a recent blog post Akash Mehta showed how to reach into a Microsoft document (a Word file) and pull out the content inside via a PHP script.

Communicating via COM in PHP is easy as ever; especially for people coming from a VB background where executing complex tasks in MS-applications is a piece of cake, you will feel right at home in PHP. In fact, VB COM calls can be converted to PHP COM calls in just a few simple search and replaces.

He shows how to use the COM extension in a (Windows) PHP installation to access the text inside the document and manipulate the contents however you'd like (even writing them back out to another Word file).

tagged: com document word extract content manipulate

Link:

Maarten Balliauw's Blog:
Indexing Word 2007 (docx) files with Zend_Search_Lucene
Feb 05, 2008 @ 16:24:00

Maarten Balliauw has written about a method he's developed to convince the Zend_Search_Lucene component of the Zend Framework to index the contents of a Word 2007 document.

Lucene basically is an indexing and search technology, providing an easy-to-use API to create any type of application that has to do with indexing and searching. If you provide the right methods to extract data from any type of document, Lucene can index it. [...] Sounds like a challenge!

He works through the three step process to getting the searching working, the key being his readDocXContents() function that goes through the Word file and returns all the text it can find. This is passed back out so the Zend Framework component can pull the data in and search (their example is on the string "Code Access Security").

You can grab the the full code here.

tagged: zendframework zendsearchlucene word document download

Link:

Maarten Balliauw's Blog:
OpenXML in Healthcare in PHP
Oct 29, 2007 @ 20:29:36

Maarten Balliauw points out a new blog post he's made today showing how to take the methods described in this article on the MSDN and convert it to a more PHP way of thinking, parsing the OpenXML info of the patients.

The scenario for the article is quite simple: Contoso provides a central medical records database. Whenever a physician has to register a new patient, he downloads a Word 2007 document from the Contoso server, fills it out, and uploads it back. Contoso then strips out the necessary data and saves it back in their systems.

This Word 2007 document is crafted around embedded custom XML data, which is displayed and edited using Word 2007. In short: to do the above exercise, you just need to strip out the custom XML and you're done.

Don't worry, Maarten includes his code and a demo to show the functionality in action. Check out the original article for more information as well.

tagged: openxml healthcare custom xml word microsoft openxml healthcare custom xml word microsoft

Link:

Maarten Balliauw's Blog:
OpenXML in Healthcare in PHP
Oct 29, 2007 @ 20:29:36

Maarten Balliauw points out a new blog post he's made today showing how to take the methods described in this article on the MSDN and convert it to a more PHP way of thinking, parsing the OpenXML info of the patients.

The scenario for the article is quite simple: Contoso provides a central medical records database. Whenever a physician has to register a new patient, he downloads a Word 2007 document from the Contoso server, fills it out, and uploads it back. Contoso then strips out the necessary data and saves it back in their systems.

This Word 2007 document is crafted around embedded custom XML data, which is displayed and edited using Word 2007. In short: to do the above exercise, you just need to strip out the custom XML and you're done.

Don't worry, Maarten includes his code and a demo to show the functionality in action. Check out the original article for more information as well.

tagged: openxml healthcare custom xml word microsoft openxml healthcare custom xml word microsoft

Link:

JSLabs Blog:
How to create Microsoft Office Documents with PHP
Jul 02, 2007 @ 17:02:00

From the JSLabs blog today, there's a quick illustration of how to dynamically create three different types of Microsoft Office files - a Word document, Powerpoint and an Excel file.

There are two main ways to build Excel, Word, and PowerPoint documents using PHP. The first is by using the COM library (only if you are using a Windows server) and the other is by using a more standardized approach such as HTML or CSV.

All three examples use the COM method and make basic structures to save out. They also include a screenshot (and description) showing where you can find the list of functions you can call to the COM object for each application.

tagged: microsoftoffice document excel powerpoint word com object microsoftoffice document excel powerpoint word com object

Link:


Trending Topics: