SWIG php how to call reference arguments - arguments

I am trying to use my C++ libraries in PHP with SWIG, everything work fine and I generated my shared object precisely. I also include phppointers.i and std_string.i in my interface file. but when I want to call my C++ methods which have reference or pointer arguments in their input section, the method just would not work properly or I got some errors like :
Fatal error:no matching function
for example one of my methods is declared as below:
int func(string &ptr,bool space=true) const;
but when I call this method in my php code as:
$bf->func('abcd',true);
I got this error:
Fatal error:no matching function
I tried to call this function with other ways like:
$str = 'abcd';
$bf->func(&$str,true);
but this time I got following error:
Fatal error: Call-time pass-by-reference has been removed
I am totally confused, I truly appreciate if someone can help me with this problem.

Related

How to have usefull debugging or error messages from laravel

I'm a bit new to laravel, but I'm experienced in Php.
In previous works, I set a mecanism that allowed me to be informed when nearly any problem occurred on the server:
I got full stack
precise PHP error messages
for nearly all king of errors
a mail sent to me
So when I began to work with laravel, I tried to do the same things, and achieved:
full stack
a mail sent to me
But I can't have meaningful error in all case. One example:
$store = Store::create(...)
In this line I forget to specify the namespace (\App\Store::create), and I get those error messages:
first:
FatalThrowableError ; Type error: Argument 1 passed to App\Http\Controllers\User::create() must be an instance of Illuminate\Http\Request, array given, called in /var/www/html/laravel/blog/app/Http/Controllers/User.php on line 94
second:
ErrorException ; Trying to get property of non-object in VerifyCsrfToken.php (line 156)
third:
FatalThrowableError ; Type error: Argument 1 passed to Illuminate\Session\Middleware\StartSession::addCookieToResponse() must be an instance of Symfony\Component\HttpFoundation\Response, array given, called in /var/www/html/laravel/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php on line 72
I understand that laravel is a complex framework but I can't figure why it produces this errors, and how I can have more useful errors (as as it is I can only know that "something is bad").
Has someone an idea ?
¹ There is some errors that Php prefers to keep to himself (in its logs) :-)
When you start a new Laravel project, error and exception handling is
already configured for you. The App\Exceptions\Handler class is where
all exceptions triggered by your application are logged and then
rendered back to the user.
https://laravel.com/docs/5.4/errors
I recommend you to dive into the official docs and into your App\Exceptions\Handler.
Maybe you are looking for report and render methods in that class.
I finally cornered the problem and I learned a lot.
I thank for their benevolence #Don't Panic and #Vitalmax !
The error was that I forgot that PHP namespaces are case insensitive: in my post I cleaned a bit the code as I knew that it didn't stick to the code's conventions (a controller's name must begin with a capital letter). Originally my controller name was user and the faulty code was:
$user = User::create(...)
As you can guess PHP believed that I wanted to call user::create (as I have such a method in my controller) and not User::create (as I wanted).
What I learned:
don't alter the code when asking for help
Laravel use a cache system that can get in the way of the debugging (see a question that I asked on laracast's forum )
take more time to read the error message; I know this rule but I keep doing otherwise

Error type go lang

Is error type in Go "Error" or "error"? It bugged me that in the Tour it is with small first letter so I looked around and found here with small e yet here in source code it is with big capital letter.
Also how can it be without big capital letter yet still visible outside of package?
Just started learning Go so I might have missed something basic, thanks.
error is the type, lowercase. Just like with int and string it doesn't need to be visible as it is built-in to Go:
A good blog post on error handling
The runtime package you're referring to has an Error interface. The type there is an interface not error:
Package runtime
type Error interface {
error
// RuntimeError is a no-op function but
// serves to distinguish types that are run time
// errors from ordinary errors: a type is a
// run time error if it has a RuntimeError method.
RuntimeError()
}
The Error interface identifies a run time error.

Why is the (PyQt5) QWidget not being added to the QBoxLayout

Right so essentially I am creating a user interface and have attempted to add a QtWidgets.QLineEdit to a QVBoxLayout as well as a QtWidgets.QLabel to a different QVBoxLayout. Unfortunately it is not working and throwing up an error:
in build_gui_adddata_device
self.labellayout.addWidget(self.labelsupplierid)
TypeError: QBoxLayout.addwidget(QWidget; int stretch=0, Qt.Alignment alignment=0): first argument of unbound = method must have type QBoxLayout
I have defined labellayout as thus:
print("e")
self.labellayout = QtWidgets.QVBoxLayout
"e" was printed, which is how I know that there is no issue with the definition of the layout itself.
Just for reference this is the QtWidget I was trying to add:
print("f")
self.labelsupplierid = QtWidgets.QLabel("Supplier ID: ")
Again "f" was printed
This is the line that is causing the problem:
print("i")
self.labellayout.addWidget(self.labelsupplierid)
I don't understand why my code isn't working, I am honestly perplexed. My syntax seems to be correct and I have made other build_gui functions that have executed exactly the same type of code (with different widgets, might I add) that have been successful.
Please can someone enlighten me. Many Thanks.

PHP Fatal error: Call to a member function getColumn() on a non-object in propel-gen diff

When I try to change the table structures using propel I am getting a Fatal error when I try to execute propel-gen diff. So how to resolve the issue?
PHP Fatal error: Call to a member function getColumn() on a non-object in /usr/share/php/data/propel_generator/lib/reverse/mysql/MysqlSchemaParser.php on line 329
This happens when there's a parsing error in your schema. You've probably changed something in your schema and that's now causing the failure. Best you undo whatever change to the last valid schema, then try and re-apply your changes bit by bit and validate as you're making change.
It's difficult thought to point out the issue without your schema.

QTP Run Error:Type does not match

Here is a sniplet of the QTP code :
Call CreateResultFile("E:\2012MX\Result\test_d\")
And the error is:
The test run cannot continue due to unrecoverable error. Type does not
match:'CreateResultFile'
What am I doing wrong?
This is the error you would get if CreateResultFile wasn't defined, are you sure such a function exists?
1) Somewhere CreateResultFile is declared as an variable, array or as an class/object. It cann't be called, but has to be used as an object of that type.
-or-
2) You did not use Option Explicit in your script (An Unforgivable Sin: each time you run a script without option explicit, somewhere on Earth a puppy dies). QTP sees undefined functions automagically as undeclared variables and complains with "Type mismatch" as explained in 1.
It could be you did not associate the library (vbs or qfl file) with the CreateResultFile function as a resource to the action you are working in.

Resources