11 September 2013
When you’re working with Drupal 6, it’s sometimes necessary to inspect the data stored in a node’s field. This is especially useful for debugging or when you’re trying to understand the structure of the content better. One quick way to achieve this is by dumping the field contents as an array. In PHP, the var_export() function comes in handy for this purpose.
Here’s how to do it:
var_export(content_fields('field_name_of_the_field', 'name_of_the_content_type')); In this snippet, replace 'field_name_of_the_field' with the actual name of the field you’re interested in and 'name_of_the_content_type' with the specific content type containing that field.
...
18 January 2011
How to Solve the Puppet Error: Could not find class in namespace # Sometimes, when working with Puppet, you may encounter an error message that does not accurately reflect the actual problem. For example, if you see this error:
err: Could not retrieve catalog: Could not find class php in namespaces standardbuild at /etc/puppet/manifests/templates.pp:15 on domain.internal.com
One of the possible causes could be a missing curly bracket in your code.
...
17 January 2011
How to install PHP development files
If you want to run phpize on your system, you need to install the development files of PHP first. Otherwise, you might get an error message like this:
sh: phpize: not found ERROR: `phpize' failed To install the PHP development files on Ubuntu/Debian, you can use the following command in the terminal:
apt-get install php5-dev That should solve the problem. 🙂
30 September 2010
Perl: time PHP: time() Ruby: Time.now # (or Time.new). To display the epoch: Time.now.to_i Python: import time # first, then int(time.time()) Java: long epoch = System.currentTimeMillis()/1000; Microsoft .NET C#: epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; VBScript/ASP: DateDiff("s", "01/01/1970 00:00:00", Now()) Erlang: calendar:datetime_to_gregorian_seconds(calendar:now_to_universal_time( now()))-719528*24*3600. # OR element(1, now()) * 10000 + element(2, now()). MySQL: SELECT unix_timestamp(now()) PostgreSQL: SELECT extract(epoch FROM now()); Oracle PL/SQL: SELECT (SYSDATE - TO_DATE('01-01-1970 00:00:00', 'DD-MM-YYYY HH24:MI:SS')) * 24 * 60 * 60 FROM DUAL SQL Server: SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE()) JavaScript: Math.
...
17 March 2010
…yes just 2 lines # For Ubuntu x64 # sudo su
cd /tmp && mkdir php53 && cd php53 && wget && wget && dpkg -i *.deb && echo “deb http://php53.dotdeb.org stable all” » /etc/apt/sources.list && aptitude update && aptitude install libapache2-mod-php5=5.3.1 apache2
For Ubuntu 32 bit i386 # sudo su
cd /tmp && mkdir php53 && cd php53 && wget && wget && dpkg -i *.deb && echo “deb http://php53.
...
12 July 2009
The economy is changing rapidly, and developers need to keep up with the latest trends and skills to stay relevant and competitive. Here is a list of 9 skills that every developer should master or at least be familiar with in the next five years. This list is not comprehensive, and it does not cover every niche or specialty in the industry. However, for most mainstream development scenarios, these skills will give you an edge over others and help you create better solutions.
...