Telligent's Community Server has a REST API that allows developers to tap into almost every aspect of the database. While creating an importer for WordPress I was attempting to backfill posts with the correct publish date. Telligent provides the publish date through a field called PublishedDate, however in its default format the date is not very useful. The default date from the API looks similar to:
(Yes, including the slashes!)
WTF is that???
After spending a couple hours wrangling the data I finally got it to a place where it was close to the correct post time, however it was always off by a couple hours. This caused issues when rewriting inter-post links as the day of the post was sometimes incorrect, thus causing the year/month/day permalink to be invalid.
Then I found a hidden API parameter that solved all my issues...
Add UseIsoDateFormat=true to the the URL parameters and the following ISO date format will be returned:
From there it is easy peazy to convert it into any format you may need.
WebMatrix is a free web development tool produced by Microsoft. WebMatrix is a complete development environment that not only provides a code editor, it also creates a new private instance of IIS Express to debug your project in, and downloads any dependencies your project may need, I.E. SQL Server Express, MySQL, PHP, etc.
I was asked what I thought of WebMatrix, however I have not spent a lot of time with it. I was working on a project that utilizes Windows Azure Web Sites and the App Gallery install of phpBB with another fellow. He was handling all the coding while I was administering the site through the web interface. I am now also coding for the site so I figured this is the perfect time to take WebMatrix for a spin..
Right off the bat I can tell you that if you are using Windows Azure Web Sites WebMatrix is a nice go to tool. WebMatrix is integrated with the Windows Azure Portal. Select your site from the Portal and there is a "WEBMATRIX" button on the toolbar. I did not have WebMatrix installed prior to starting this process. One-click of the button and WebMatrix was installed for me via Web Platform Installer.
Clicking the “WEBMATRIX” button automatically downloads the publish settings and sets up the WebMatrix environment for your project. Because WebMatrix understands phpBB it even pulled the PHP and SQL Server dependencies! The files and database were copied to my local machine. I am now able to interact with the phpBB web site through WebMatrix as an exact replica of the production website.
WebMatrix even has a nifty tool that alerts you if you attempt to make changes to project core files.
I made a few changes and clicked Run. My default browser opened and I was able to poke around the website as if it was running live. Satisfied that all seemed to be in working order, I clicked the Publish button a few minutes later. WebMatrix did a comparison of the files on the server to the local files to let me know which had changed. I could selectively choose which files to publish and which to retain. Even cooler, WebMatrix has an option to push back the entire database.
WebMatrix also supports code insight, or “Intellisense”, which is handy for finding class and function documentation throughout a project.
What is my verdict on WebMatrix? It seems to have matured into a great tool that is highly useful for web developers. Using Windows Azure Web Sites, or the WebMatrix Gallery you can, with a few clicks, have one of many popular open source content management systems (such as WordPress, Drupal, Joomla!) setup and running. The Publish feature eliminates the need for any additional applications to send files to the server. Additionally the automatic check of the server for changed files is very handy at ensuring only the proper files get uploaded or changed. Drawbacks? It currently only supports the Windows operating system.
Moving forwards I have a feeling WebMatrix will become my web code editor of choice, especially when working on Windows Azure related projects.
If you are attempting to find a count of the total lines of code in files in a directory recursively from Linux or Mac OS X the following command will do what you want. This particular command prints out all lines contained in any file with a .php extension, then counts the number of lines printed.
If you need to locate a file somewhere within a given path this code snipped will do it for you. Please note that it only works on files systems that can handle the Linux style architecture. This means that the code will likely not work on a Windows Server.
I created this snippet specifically to locate the WordPress wp-load.php file in the path, however it should be noted that I do not necessarily advocate this method, it simply worked and was quick to implement. I am posting it here for posterity. Perhaps someone can benefit from it.
Please post a comment if you know of a better solution.
Problem: wp-load.php is somewhere in the path but it is unknown where. wp-load.php needs to be included from a file that may potentially move around.
* Searches for a file in the path upwards from the provided $path
* NOTE: This *ONLY* works with Linux based path structures. I.E. Will likely
* not work with any Windows server
* @param String $file - Name of file to find
* @param String $path - (Optional) Path to begin searching from. Defaults to current
* @return Mixed - Full path to file or null if not found