I have try to simulate and develop base of some zend project
and in first step I copy all FTP file & folder to my local computer
but application send me below error (in loading plugin from source )
( ! ) Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name '_' in C:\wamp\Mina\library\Zend\Loader\PluginLoader.php on line 398
( ! ) Zend_Loader_PluginLoader_Exception: Plugin by name '_' was not found in the registry; used paths: Mina_View_Helper_: Mina/View/Helper/ App_View_Helper_: App/View/Helper/ Zend_View_Helper_: Zend/View/Helper/;C:/wamp/Mina/application/modules/default/views\helpers/ in C:\wamp\Mina\library\Zend\Loader\PluginLoader.php on line 398
even some plug in exsist that hides in var_dumped error array in pluginloader.php line 398
like this:
string 'Db' (length=2)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Translate' (length=9)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Layout' (length=6)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Frontcontroller' (length=15)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'ViewRenderer' (length=12)
array
'Zend_Controller_Action_Helper_' =>
array
0 => string 'Zend/Controller/Action/Helper/' (length=30)
string 'Navigation' (length=10)
array
'Mina_View_Helper_' =>
array
0 => string 'Mina/View/Helper/' (length=16)
'App_View_Helper_' =>
array
0 => string 'App/View/Helper/' (length=16)
'Zend_View_Helper_' =>
array
0 => string 'Zend/View/Helper/' (length=17)
1 => string './views\helpers/' (length=16)
string 'View' (length=4)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Modules' (length=7)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Router' (length=6)
array
'Zend_Application_Resource_' =>
array
0 => string 'Zend/Application/Resource/' (length=26)
string 'Word_CamelCaseToDash' (length=20)
array
'Zend_Filter_' =>
array
0 => string 'Zend/Filter/' (length=12)
string 'StringToLower' (length=13)
array
'Zend_Filter_' =>
array
0 => string 'Zend/Filter/' (length=12)
that mines some plugins doesn't exist
but original project works with this situation
in further convey i find that index.php references some library that i cant see with any tricks on FTP server
(Line 5 Of Below Code:)
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../library'),
realpath(APPLICATION_PATH . '/../library'),
realpath(APPLICATION_PATH . "/models"),
realpath(APPLICATION_PATH . "/forms"),
get_include_path(),
)));
tree map of original project Going on this link
in further there is not any navigation.php in my library folder not like that errors says (except zendframework classes)
and every of this namespace (and view helpers) are registred in application.ini
because no plugins have runs no page are displayed.
Share me if you had any idea about this error
I have no idea if this is the correct answer, but its worth a shot...
The simplest way I could think of to reproduce this error myself was to insert the following code into one of my views:
<?php echo $this->_( 'Some text' );?>
This suggests to me that maybe your application uses the gettext module for language translation, and maybe it is configured on your server but not on your local machine. Running phpinfo() should confirm this fairly quickly. This is the only explanation I can deduce from the information I have gleaned from your question.
Of course, if somebody had used gettext to multi-lingualize the app, I'm pretty sure they would not have included "$this->" before the underscore, so this is a bit of an anomaly in my answer.
Related
I need a brief explanation of how can I convert MySQL data to Elastic Search using logstash.
can anyone explain the step by step process about this
This is a broad question, I don't know how much you familiar with MySQL and ES. Let's say you have a table user. you may just simply dump it as csv and load it at your ES will be good. but if you have a dynamic data, like the MySQL just like a pipeline, you need to write a Script to do those stuff. anyway you can check the below link to build your basic knowledge before you ask How.
How to dump mysql?
How to load data to ES
Also, since you probably want to know how to covert your CSV to json file, which is the best suite for ES to understand.
How to covert CSV to JSON
You can do it using the jdbc input plugin for logstash.
Here is a config example.
Let me provide you with a high level instruction set.
Install Logstash, and Elasticsearch.
In Logstash bin folder copy jar ojdbc7.jar.
For logstash, create a config file ex: config.yml
#
input {
# Get the data from database, configure fields to get data incrementally
jdbc {
jdbc_driver_library => "./ojdbc7.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:#db:1521:instance"
jdbc_user => "user"
jdbc_password => "pwd"
id => "some_id"
jdbc_validate_connection => true
jdbc_validation_timeout => 1800
connection_retry_attempts => 10
connection_retry_attempts_wait_time => 10
#fetch the db logs using logid
statement => "select * from customer.table where logid > :sql_last_value order by logid asc"
#limit how many results are pre-fetched at a time from the cursor into the client’s cache before retrieving more results from the result-set
jdbc_fetch_size => 500
jdbc_default_timezone => "America/New_York"
use_column_value => true
tracking_column => "logid"
tracking_column_type => "numeric"
record_last_run => true
schedule => "*/2 * * * *"
type => "log.customer.table"
add_field => {"source" => "customer.table"}
add_field => {"tags" => "customer.table" }
add_field => {"logLevel" => "ERROR" }
last_run_metadata_path => "last_run_metadata_path_table.txt"
}
}
# Massage the data to store in index
filter {
if [type] == 'log.customer.table' {
#assign values from db column to custom fields of index
ruby{
code => "event.set( 'errorid', event.get('ssoerrorid') );
event.set( 'msg', event.get('errormessage') );
event.set( 'logTimeStamp', event.get('date_created'));
event.set( '#timestamp', event.get('date_created'));
"
}
#remove the db columns that were mapped to custom fields of index
mutate {
remove_field => ["ssoerrorid","errormessage","date_created" ]
}
}#end of [type] == 'log.customer.table'
} #end of filter
# Insert into index
output {
if [type] == 'log.customer.table' {
amazon_es {
hosts => ["vpc-xxx-es-yyyyyyyyyyyy.us-east-1.es.amazonaws.com"]
region => "us-east-1"
aws_access_key_id => '<access key>'
aws_secret_access_key => '<secret password>'
index => "production-logs-table-%{+YYYY.MM.dd}"
}
}
}
Go to bin, Run as
logstash -f config.yml
i have update laravel 5.3 to 5.4 than i got this error for using laravel filemanager package Unisharp.
FatalErrorException in ItemsController.php line 0: Method
Illuminate\View\View::__toString() must not throw an exception, caught
ErrorException: Cannot use object of type stdClass as array (View:
ProjectName\resources\views\vendor\laravel-filemanager\item.blade.php)
(View:
ProjectName\resources\views\vendor\laravel-filemanager\item.blade.php)
return [
'html' => (string)view($this->getView())->with([
'files' => $files,
'directories' => $directories,
'items' => array_merge($directories, $files)
]),
'working_dir' => parent::getInternalPath($path)
];
add in the vendor views item.blade.php in the line 0
<?php $file = json_decode(json_encode($file),true) ; ?>
I'd like to translate a perl web site in several languages. I search for and tried many ideas, but I think the best one is to save all translations inside the mySQL database. But I get a problem...
When a sentence extracted from the database contains a variable (scalar), it prints on the web page as a scalar:
You have $number new messages.
Is there a proper way to reassign $number its actual value ?
Thank you for your help !
You can use printf format strings in your database and pass in values to that.
printf allows you to specify the position of the argument so only have know what position with the list of parameters "$number" is.
For example
#!/usr/bin/perl
use strict;
my $Details = {
'Name' => 'Mr Satch',
'Age' => '31',
'LocationEn' => 'England',
'LocationFr' => 'Angleterre',
'NewMessages' => 20,
'OldMessages' => 120,
};
my $English = q(
Hello %1$s, I see you are %2$s years old and from %3$s
How are you today?
You have %5$i new messages and %6$i old messages
Have a nice day
);
my $French = q{
Bonjour %1$s, je vous vois d'%4$s et âgés de %2$s ans.
Comment allez-vous aujourd'hui?
Vous avez %5$i nouveaux messages et %6$i anciens messages.
Bonne journée.
};
printf($English, #$Details{qw/Name Age LocationEn LocationFr NewMessages OldMessages/});
printf($French, #$Details{qw/Name Age LocationEn LocationFr NewMessages OldMessages/});
This would be a nightmare to maintain so an alternative might be to include an argument list in the database:
#!/usr/bin/perl
use strict;
sub fetch_row {
return {
'Format' => 'You have %i new messages and %i old messages' . "\n",
'Arguments' => 'NewMessages OldMessages',
}
}
sub PrintMessage {
my ($info,$row) = #_;
printf($row->{'Format'},#$info{split(/ +/,$row->{'Arguments'})});
}
my $Details = {
'Name' => 'Mr Satch',
'Age' => '31',
'LocationEn' => 'England',
'LocationFr' => 'Angleterre',
'NewMessages' => 20,
'OldMessages' => 120,
};
my $row = fetch_row();
PrintMessage($Details,$row)
I am developing an application with Laravel 5.2 I need to return some JSON response from Postgresql database, but I am getting the following error (I posted the first lines of error message)
in Carbon.php line 425
at Carbon::createFromFormat('Y-m-d H:i:s', '2016-06-07 10:06:23.701566') in Model.php line 2958
at Model->asDateTime('2016-06-07 10:06:23.701566') in Model.php line 2451
at Model->attributesToArray() in Model.php line 2428
at Model->toArray() in Collection.php line 1023
at Collection->Illuminate\Support\{closure}(object(Category))
at array_map(object(Closure), array(object(Category), object(Category))) in Collection.php line 1024
at Collection->toArray() in JsonResponse.php line 48
at JsonResponse->setData(object(Collection)) in JsonResponse.php line 49
the records in database have 2 fields created_at and updated_at which both are timestamp type
this is what is returned and printed by dd() function for one row
"id" => 1
"name" => "category1"
"description" => "category 1 decription "
"created_at" => "2016-06-07 10:06:23.701566"
"updated_at" => "2016-06-07 10:06:23.701566"
]
and this is my function in Controller `use App\Http\Requests;
use App\Category;
class CategoryController extends Controller
{
public function index()
{
$categories = Category::all();
return response()->json($categories);
}
help me please through this issue how to get it working and also let me know if I have to provide any further information
Seems that Carbon is trying to format your date with:
Carbon::createFromFormat('Y-m-d H:i:s', '2016-06-07 10:06:23.701566')
The correct format should be as below, which includes the microseconds.
Carbon::createFromFormat('Y-m-d H:i:s.u', '2016-06-07 10:06:23.701566')
Try putting this in your Category model file.
protected $dateFormat = 'Y-m-d H:i:s.u';
sorry but i didn't knew how to explain the question in on sentence...
actually i have code like this when i do mysql_fetch_array...
[0] => 10
[id] => 10
[1] => 58393
[iid] => 58393
[2] => 0
[ilocationid] => 0
[3] => 38389
[iapptid] => 38389
[4] => 2012-06-30T00:00:00
[ddate] => 2012-06-30T00:00:00
[5] => 1000
[ctimeofday] => 1000
but i want to return something like this
[id] => 10
[iid] => 58393
[ilocationid] => 0
[iapptid] => 38389
[ddate] => 2012-06-30T00:00:00
[ctimeofday] => 1000
i mean without the numeric representatives of the columns. how do i do it...please help...
As explained in the manual for PHP's mysql_fetch_array() function:
The type of returned array depends on how result_type is defined. By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).
Therefore, you want either:
mysql_fetch_array($result, MYSQL_ASSOC);
or
mysql_fetch_assoc($result);
Note however the warning:
Use of this extension is discouraged. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
mysqli_fetch_array()
PDOStatement::fetch()