segunda-feira, 25 de agosto de 2014

dyld: Symbol not found: __cg_jpeg_resync_to_restart

Ao usar o MAMP PRO e o YUI Compressor surgiu-me este erro:

==> /Applications/MAMP/logs/apache_error.log <==
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

==> /Applications/MAMP/logs/php_error.log <==
[25-Aug-2014 12:06:04 Europe/Lisbon] YUI Compressor returned error
O problema é que o MAMP PRO faz export da variável DYLD_LIBRARY_PATH. Solução: editar o ficheiro: "/Applications/MAMP/Library/bin/envvars" e comentar o seu conteúdo. Ficheiro original:
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# envvars-std - default environment variables for apachectl
#
# This file is generated from envvars-std.in
#
if test "x$DYLD_LIBRARY_PATH" != "x" ; then
  DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
else
  DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib"
fi
export DYLD_LIBRARY_PATH
#
Ficheiro editado:
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# envvars-std - default environment variables for apachectl
#
# This file is generated from envvars-std.in
#
#if test "x$DYLD_LIBRARY_PATH" != "x" ; then
#  DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
#else
#  DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib"
#fi
#export DYLD_LIBRARY_PATH
#

quarta-feira, 7 de maio de 2014

Windows 8 erro 0x800F0907

A forma mais simples de se ver livre do erro 0x800F0907 do Windows 8 é a seguinte:

1 - Colocar o DVD do Windows no leitor
2 - Abrir uma linha de comandos com permissões de administrador
na pesquisa escrever "cmd" (1), botão direito e "Run as Administrator"
3 - Já na linha de comandos, digitar:
C:\Windows\system32>DISM /online /enable-feature /all /featurename:NetFx3 /source:g:\sources\sxs

Deployment Image Servicing and Management tool
Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

C:\Windows\system32>

ATENÇÃO: respeitem as maiúsculas.

domingo, 16 de março de 2014

EmbedForm with new relation

To insert new attributes to a Product in the default form we just need those few steps:

In the productForm class create the relation with the attribute form.

public function configure() {
    /* Create embedForm with an empty attribute */
    $new_attribute = new ProductAttribute();
    $new_attribute->setProduct($this->object);
    $this->embedForm('new_attribute', new ProductAttributeForm($new_attribute));
    $this->embedRelation('Attributes', new ProductAttributeForm());
}

...and we rewrite the saveEmbeddedForms methods
public function saveEmbeddedForms($con = null, $forms = null) {
    try {
        $new_attribute_form = $this->getEmbeddedForm('new_attribute');
        $values             = $this->getValue('new_attribute');

        /* Validations Rules to save the relation */
        if (empty($values['attribute_id'])) {
            unset($this['new_attribute']);
        }
    } catch (InvalidArgumentException $e) {
        error_log($e->getTraceAsString());
    }
    return parent::saveEmbeddedForms($con, $forms);
}

quarta-feira, 12 de março de 2014

Oracle extension oci8 in PHP5


Install OCI8 on PHP

Needs:
pecl    - sudo apt-get install php-pear
phpize  - sudo apt-get install php5-dev


1. Download "Oracle Instant Client Basic and SDK" from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
2. Extract the content of both archives to /etc/opt/oci8/
3. Go to /etc/opt/oci8/ and find the file called libclntsh.so.*.* (e.g. libclntsh.so.12.1) and create a symbolic link called libclntsh.so
    . sudo ln -s libclntsh.so.12.1 libclntsh.so
4. Install the package libaio-dev
    . sudo apt-get install libaio-dev
5. Install now the oci extension:
    . sudo pecl install oci8
        . when prompt insert the path to the path to instantclient: instantclient,/etc/opt/oci8/
    Build process completed successfully
    Installing '/usr/lib/php5/20121212/oci8.so'
    install ok: channel://pecl.php.net/oci8-2.0.7
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=oci8.so" to php.ini
6. Locate your php.ini and add the line "extension=oci8.so"

terça-feira, 4 de março de 2014

Git color

Edit your ~/.gitconfig and add the followind lines:

[color "status"]
added = green
changed = red bold
untracked = magenta bold
[color "branch"]
remote = yellow
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true