While playing with strings one should be VERY VERY VERY cautious when trying to check for a “null” value
PHP has the bad habit of considering empty strings to be “null” and “false” , for instance
1 2 3 4 | $foo = ''; if( $foo == null && $foo == false ){ echo "So PHP actually considers empty strings to be null and false"; } |
Accessing the first element in a php array can be done as easy as this
$myArray[0] = 'foo';
and you can also use “list” to access more than one index in one call
list( $first, $second, $third ) = $myArray;
This approach , however, doesn’t work with associative arrays or arrays that have non-standard integer index like
$stringIndexedArray = array('first' => 'data','second' => 'data'); $nonStandardIntegerIndexedArray = array(5 => 'foo', 7=>'bar');
I have found two methods to access the first element in such arrays, one using “reset” and the other using “array_values”
$stringIndexedArray= array( 'first' => 'Data 1', 'second' => 'Data 2', 'third' => 'Data 3', 'forth' => 'Data 4', 'fifth' => 'Data 5' ); //reset method //Average execution time : 2.8123000000003E-6 $firstElement = reset($stringIndexedArray); //array_values method //Average execution time : 3.8123000000001E-6 list($firstElement) = array_values( $stringIndexedArray );
I’ve done some profiling and turns out that “reset” method is slightly faster than “array_values” ( as seen in code comments )
For some reason my Firefox default search engine has been set to “Microsoft’s Bing” search engine, I wanted to set it back to the default “Google”, so this is what I did after some research
I accessed the config url “about:config” from Firefox and modified the following values

browser.search.defaultenginename : Google
browser.search.defaulturl : http://www.google.com/search?hl=en&q=
keyword.URL : http://www.google.com/search?hl=en&q=
My proposal for Google Summer of code 2009 has been accepted, I’ll be working for Joomla! this summer , My project will be “Workflow extension” for Joomla! 1.6
I’ll try to describe what I’m trying to accomplish to get as much feedback as possible before starting.
The workflow extension I’ll be working on will support the core content component and have the capacity to support other components.
Document workflow will be broken down into a set of “stations” ,An item will be passed from one station to another in a particular order until reaching its final station after which an arbitrary operation will be preformed “e.g. Publish article”.
MVC based, the core will act as a central controller for the whole extension, it is composed of two parts:
1. A conventional component
2. Core plugin: A system plugin that captures J! Triggers related to content saving and passes them down to “Component handlers” (See below)
Hooks will be implemented to allow developers to perform arbitrary actions when certain events occur, initially one hook will be implemented, this hook will be invoked upon transition from one station to the next.
They handle the rendering and storage of the “station” fields (e.g. comment fields, file attachments, etc…)
All component specific code will be placed here, these handlers act as a layer between the extension and the component whose content is being workflowed (e.g. com_content),
Each handler is composed of 2 files
1. An XML file that contains Meta data about the handler and a other parameters, among which is the “onSaveItem trigger name” which defines the name of the “J! Event” that is triggered when an item of the handler type is saved. (E.g. onAfterSave in com_content), the file also contains a list of supported “Final Actions”, which are the actions that can be taken when the item reaches its final destination (e.g. publish, delete, archive, etc…)
2. A php file containing implementation of the handler, it must implement the following methods ( Subject to change as needed )
• lockElement (id)
• unlockElement (id, gid)
• onItemEdit ()
• getItemRevision(id, rev)
More on getItemRevision()
If the component in question (e.g. com_content) does support version control, the method returns the requested version, if it doesn’t, then the method simply ignores the $rev parameter and returns whatever stored in the DB.
The above list of methods is a preliminary list and is subject to change as development progresses
When the workflow is saved, the component’s onSaveItem trigger is registered with core plugin so that when the event is triggered the core plugin captures it and loads the correct component handler.
When working with workflows content is likely to be edited several times before reaching its final form, which raises the question of “versioning” , This extension will NOT handle version control of content elements that are being workflowed but will have internal support for version control should it be included in future versions of the content management.
This internal support will be provided through “component handler” plugins which allows each component to have its own way of dealing with version control if it supports it, and to ignore it if it doesn’t support it.
The Administrator wants to create a new workflow for publishing content in a particular set of categories.
The Administrator will use a backend screen to create that workflow; he can specify the categories/sections he wants to be workflowed.
The Administrator defines the “stations” and the custom fields for each station and saves the workflow.
User xyz posted an article, the onAfterSave event is triggered, the core plugin captures this event and loads the component handler that corresponds to the content type (com_content handler in this case)
The component handler for “com_content” locks the article for all groups of users and unlocks it for the ACL group of station 2.
In the process of transition between two stations, A hook is invoked, calling all registered handlers, One of these handlers will send an E-mail to station users about the item that waits processing.
Station 2 user logs into J! And accesses the “pending items” view (Accessible via frontend or backend), station 2 fills the custom fields assigned to the station (comment and file attachment) and passes the article up to station 3.
The core locks the article for everybody except station 3, the article proceeds in similar manner until it reaches its final destination where the “final action” will be decided, supported final actions will be “component handler” dependent, for com_content, I cannot think of anything aside from “publish, delete, move to category/section”.
The component will have several views, but nothing out of the ordinary,except for the view that allows the administrator to create the workflow, This view will feature some javascript magic to increase usability, I’ll borrow some code from JForms :) .
I’ve just upgraded to WP 2.7, Now its time to port/adapt/change/modify my RTL-LTR code to 2.7
I also need to clean up my tags, add a few links here and there, modify the theme, lots of work it seems.
I like how 2.7 looks, Many thanks to everybody who’s contributed to this.
_
Quoting
“Normal values pocket” , Preface
Author : Michael Jakob, M.D.
ISBN : 1-59103-205-9
Everyone involved in medical/clinical work has undoubtedly been faced with the task of assessing lab values, functional parameters, and measurement categories for technical equipment, without having information on normal ranges at hand. As a consequence, it has always been necessary to check with the lab in question and make time-consuming searches through the appropriate literature. This problem mainly affects our younger and less experienced colleagues. However, experienced professionals also know that only a small part of the parameters are relevant to the clinical routine, and many specialized values are forgotten as quickly as they are learned. Careful evaluation of the many measurement parameters that are relevant in differential diagnosis, particularly in internal medicine, should really occupy more of a doctor’s time than a tedious search for normal values and ranges.
الغرب بينسو الأرقام هما كمان, مين كان يصدق!
Quoting HTML Hell page
“Best viewed with…”
Ah, yes, “Best viewed with…” — surest sign of an incompetent web designer (unless it’s one of the parody buttons from the Viewable with Any Browser campaign). This kind of lameness is not just bad taste, it makes the site actually unusable for the large numbers of surfers who happen to be using something other than the designer’s favorite browser. Unfortunately, the sort of people who do “Best viewed with…” is also usually way too stupid to get the point if you try to explain that HTML is supposed to be about device-independence — so pull them by the guilt-strings and point out that blind people surf too. If that doesn’t work, club them to death with a chair leg or something. No court would convict.
Note: “Our” refers to Egyptian.
Today I’m launching a dedicated website for my GSoC Project “JForms” support , I’ll be publishing news and documentation of the component there, also there’s a forum for support questions and similar stuff.
My project for GSoC 2008 was to create a WYSIWYG forms component (Web form editor) that runs on Joomla! 1.5 , This video shows a simple usage scenario ( including an encounter with a bug! )
Links:
Development trunk(SVN): http://joomlacode.org/svn/gsoc2008/JForms/trunk/
JForms blog on J! Developer website
P.S : I used CamStudio to create this video.
For some reason, The whole LHC Story reminds me of the movie Contact