ACL truncates action name - mysql

Using PhalconPHP framework
I have been using ACL successfully for a while but ran into an issue when I tried using an action name that was more than 16 characters long. When I add adminChangePassword as an access under my users resource | get the error
Access 'adminChangePassw' does not exist in resource 'users'
#0 [internal function]: Phalcon\Acl\Adapter\Memory->_allowOrDeny('Administrators', 'users', 'adminChangePass...', 1)
But using the name adminChangePassw works fine (apart from that it is a rubbish name). It appears that the name is being truncated at some point which I presume would be a bug.
Is that what is happening or can anyone give another explanation of this error?
A quick test
I've just tried adding an access in the users resource called 12345678901234567 and the error says that 1234567890123456 does not exist - truncating the last 7...
Occurs in tutorial programs
I tried adding 'adminChangePassword' to the ACL in my working Vokuro example and get the same error - so it isn't related to any changes I have made to how the ACL works.

This is because I had been working from the Vokuro example code - the database for which limits the size of the action and resource fields to 16 characters. Changing the database setup to allow more characters in those fields fixes the problem.

Related

Still getting error message after `except` statement dealing with `ProgrammingError`

I am using python to automatically populate a MySQL DB. The script that populates the DB (/path/to/pythonScript.py very long) is actually called by another python script (example below) works fine and I have added a few statements that prevent me from inserting duplicated entries.
When I try to insert a duplicated entry with the script /path/to/pythonScript.py I get (as expected)
ProgrammingError: 1061 (42000): Duplicate key name 'unique_index'
In order to deal with that, I want to write a try except statement while calling the /path/to/pythonScript.py script, as shown below:
import mysql.connector
from mysql.connector.errors import ProgrammingError
# Here I have already successfully connected to the DB, and populated it
try:
get_ipython().system("ipython /path/to/pythonScript.py") # this is the script that populates the DB. It does not allow the insertion of duplicated entries
except ProgrammingError:
print("a warning message informing that I am trying to insert a duplicated entry")
When I call the script for the first time, everything goes well (after all, the DB was empty). But then when I call the script for the second time (i.e. when I attempt to insert duplicated entries) I am still getting the same error ProgrammingError: 1061 (42000): Duplicate key name 'unique_index'
I have found this documentation page where they show examples on how to handle errors, though there is no example specifically on the ProgrammingError. In this other documentation page there is one example on the ProgrammingError, though they skipped the imports section and I am afraid I am missing something by the import (note that I don't get any error when I call from mysql.connector.errors import ProgrammingError)?
You are running the other script as a distinct process. Exceptions only exist within the current process - FWIW, you could be running a shell script or a C-coded binary app instead, it would be just the same.
I kindly suggest you momentarily ditch IPython and take a couple days doing the full official Python tutorial, paying particular attention to the parts about functions and modules. Then you may want to rewrite your first script to make it a proper module with proper functions (I assume from your question and example code it's currently a plain script with everything at the top-level - but I may be wrong of course ;) ), then rewrite your calling script to import functions from the first one and call them.
Also note that that ProgrammingError can happen for a whole lot of other reasons than a duplicate key, so you MUST check the exception's code to find out which exact error happened.

Zabbix 3.4 Bits Received and Sent

I simply want to see my download and upload data in the map section but i couldnt figure out the code.
For example = When i use this ( ''{HOSTNAME : net.if.speed[Interface ge.2.47()].last()}'' ) command it says UNKNOWN but I dont know where im doing wrong.
Also tried using ( net.if.in[Interface ge.2.47(Uplink)]:last()} ) but its still not showing any data.
You can use this:
In: {systemname.with.zabbix:ifInOctets[ppp0].last(0)}
Out: {systemname.with.zabbix:ifOutOctets[ppp0].last(0)}
Of course you have to replace the systemname and the interface name (ppp0)
You find the interface names in the items section of the host. (Of course you must have some kind of agent or snmp activated on that host)

Creating classes in pimcore

I'm new to the whole pimcore thing. I am trying to play around and create classes. The issue is, I am not able to create more than 1 class, and in the database it is nameless, so when I try to create another class, it also tries to store it in the database with no name, which ends up showing an SQL error saying that there is a duplicate entry. Any ideas what the reason behind this could be?
I installed pimcore on an nginx server, I am trying to create classes by choosing Settings->Objects->Classes and then "Add Class", creating the first class was ok, I entered a name for the class and it was successfully added, however the name field in the corresponding database entry is empty, as in empty string ' '. So, when I try to add another class and pimcore attempts to store it in the table "classes", it returns an error saying that it would be a duplicate entry since they both are nameless, i.e. the name entered isn't added. The following error is what I managed to find using developer tools, could be helpful.
[WARN] Unable to parse the JSON returned by the server
minified_javascript_core_f5757da….js?_dc=3708:5684 Error: You're trying to decode an invalid JSON String:
Fatal error: Call to a member function hasChilds() on null in /var/www/html/pimproject/pimcore/modules/admin/controllers/DocumentController.php on line 59
at new Ext.Error (http://192.10.0.0/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:27054)
at Function.Ext.apply.raise (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:27447)
at Object.Ext.raise (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:27594)
at Object.Ext.JSON.me.decode (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:385102)
at Ext.define.onProxyLoad (http://192.10.0.10/website/var/tmp/minified_javascript_core_f5757da9fa29d5bf13e6aa5058eff9f7.js?_dc=3708:5641:28)
at Ext.cmd.derive.triggerCallbacks (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:594533)
at Ext.cmd.derive.setCompleted (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:594231)
at Ext.cmd.derive.setException (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:594444)
at Ext.cmd.derive.process (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:593638)
at Ext.cmd.derive.processResponse (http://192.10.0.10/pimcore/static6/js/lib/ext/ext-all.js?_dc=3708:22:648303)
Just reinstall Pimcore.
It can be some composer or submodules error.
I strongly recommend for the first installation to run Demo project https://github.com/pimcore/demo not Skeleton, especially if you are using Docker. Later, when you will get the feeling of Pimcore, feel free to install Skeleton or any other project.
Pimcore is stable working for years. If you had some problems before -- nowadays, it is stable.

Symfony2 error: Unknown database

I have a db that I'm calling "my_db". I'm trying to connect to it with Symfony2, but it keeps telling me this:
"Unknown database: "MY_DB"
What I did:
First I tried to modify the config.yml, and parameters.yml, to change the db name, since it seems to be in capitals in the error and the db name really isn't. The name in the config.yml was already in lowercase, but in parameters.yml(which I don't even use for this) it was in capitals. I changed it to make sure, but nope.. Nothing. Still same error. And yes, I cleared the cache.
Then I changed the actual mysql-database name to uppercase in phpmyadmin: "my_db" to "MY_DB", and tadaa: it worked!
Wait But Why?
There is something I'm missing here, since the names are all correct in the settings, but the problem didn't go away until I changed the database name to match the name in the error.
First it didn't work and I didn't know why. Now it works and I don't know why.
I need to know why this happens, so that nothing weird happens when I go to production later.
It's not a problem of Symfony or Doctrine, it's a problem at the database level, somehow your database is case sensitive, I think there's a way to change that by setting the lower_case_table_names system variable, read more about it here : http://dev.mysql.com/doc/refman/5.6/en/identifier-case-sensitivity.html

Error in Magmi configurable product import with Configurable Item processor

I am trying to import in Magento using Magmi a set of configurable and simple products. I have followed all the necessary steps correctly (I guess) that are described here http://wiki.magmi.org/index.php?title=Configurable_Item_processor.
Here is a test file with data that I load in the importer https://docs.google.com/spreadsheets/d/17_fWYfYmSiXdLYp80P0kafPrFYzwzp7JHGNlHQTM0S4/edit?usp=sharing
Test cases:
Running the import without Configurable Item processor works just fine but does not create the link between the simple products and the configurable ones in backend (which makes perfect sense).
Running with Configurable Item processor with all the combinations of plugin options (Perform simples/configurable link y/n & auto match simples skus before configurable y/n) yields all the time the fallowing errors:
1 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'attribute_id' cannot be null -
2 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'attribute_id' cannot be null - ERROR ON RECORD #3
The error is triggered by this line of code
INSERT INTO `catalog_product_super_attribute` (`product_id`,`attribute_id`,`position`) VALUES (?,?,?)
that you can find in /plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php:246
I have searched for a solution and found this one http://blog.mdnsolutions.com/index.php/magmi-not-importing-configurable-products/ where actually the guy solved the issue by replacing that line above with:
INSERT INTO `catalog_product_super_attribute` (`product_id`,`attribute_id`,`position`) VALUES (:a,:b,:c)
It is not working.
There is also another question on this issue posted here Magmi Configurable Products Importation however the solution appears to be very "vague".
Working with:
Magento - 1.9.0.1
Magmi - 0.7.20
Configurable Item processor - 1.3.7a
OS is Ubuntu running PHP 5.3.10 & MySQL 5.5.34
Some thoughts based on my experience:
Are any of your attributes mandatory? I suggest putting something into the size column for the configurable product.
For visibility, I use numeric values. For configurable products it should be 4, for simple products it should be 1 (you don't want them to be visible individually, rather you want them to be visible within the configurable products).
Finally, how are you creating your csv files? If just with excel, you may get problems with the encoding and how it separates fields. I run my csv files through openoffice calc to make the files UTF-8 and the text fields are properly handled.
Just ran into the exact same problem. Simples work, but configurables don't even with the exact same information/etc.
As it would turn out if there is a wrong "configurable_attributes" named attribute with a simple it still goes.
Example
_attribute_set,type,configurable_attributes,size_option,color,
"Default",simple,"color,size","Small","Gold"
No error
_attribute_set,type,configurable_attributes,size_option,color,
"Default",configurable,"color,size","Small","Gold"
Error
Turns out "color,size" was not matching to actual attribute names.
Was "color,size_option".
Check your attributes