How can I see the php function and variables in the base class I created in Atom IDE? - atom-editor

How can I see the variables of a function I created in the atom editor?
I have 2 class. XController and BaseController. Like "class XController extends \App\Controllers\admin\BaseController".
I created "public function header(string $title='')" in BaseController. How can it warn me that "There is a variable called $title" when I use this function inside Xcontroller?
but i want like this to warn me.
thanks for all kindly answers.

Related

Spring project package problem that needs to be addressed

I have tried my every possible ways of adding class in different packages such as application class in package com.packagename and my controller in different package named model and when i try to execute the program it returns the default white label error and when i put the classes in the same package it runs successfully.
So i wanted to ask if there is any problem with the project or i need to give any path.
Before I have also tried notations that says component scan and all but that to did not came handy
Let's say your main class(which is annotated with #SpringBootApplication) is in the package "com.somepackage", then try putting your controller in "com.somepackage.controller"(It is recommended that other classes are placed in the subpackage of your main class). with this change it should work.
You put your classes in wrong places and your package are very messy. You should have a structure like this
--src
main
java
com.boltforever.moviecatalog
model
service
MyService.java
controller
MyController.java
MovieCatalogServiceApplication.java
And this should work

How to make correct S4 Class declaration for a package

I am creating a personal package with some S4 classes. When I run the Build and Reload button in the Rstudio IDE I get the next message.
in method for ‘checkNewItems’ with signature ‘"webSource"’: no definition for class "webSource"
The Class declaration webSource is in a different file where the checkNewItems method is and I am guessing that is the reason why I am getting that message. In the source code that I have makes more sense to have the class declaration in other place rather than next to the methods checkNewItems.
Which is the idiomatic workaround that R programmers use for this?
Also, from the point of view of the Lazyloading that R uses I assumed that this should not happen.
You should export your class. In your namespace file you add this:
exportClasses(webSource)

How to use my namespace in Qt UI class?

I have a custom widget called gv which is in my namespace GUI. And one UI class cv in which a widget is promoted to gv. But compiler was not accepting and throwing error and then I tried the solution given here.
But now getting error: no matching function for call to 'GUI::gv::gv(QWidget*&)' in my ui_.h file. Could some one tell me what am I missing here?
Try promoting the widget to GUI::gv (specify the namespace when promoting). That worked for me (I have a form that includes many widgets that are defined in their own namespaces).

Getting error: Non-static method Phactory\Sql\Phactory::reset() should not be called statically

I have a trivially small PHPUnit test that looks like this:
<?php
namespace VNN\PressboxBundle\Tests\Entity;
namespace VNN\PressboxBundle\Entity;
use VNN\PressboxBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Phactory\Sql\Phactory;
class UserTest extends EntityTest
{
public function testCreate()
{
Phactory::reset();
}
}
When I try to run it, I get this:
There was 1 error:
1) VNN\PressboxBundle\Entity\UserTest::testCreate
ErrorException: Runtime Notice: Non-static method Phactory\Sql\Phactory::reset() should not be called statically, assuming $this from incompatible context in /Users/jason/Web/pressbox/src/VNN/PressboxBundle/Tests/Entity/UserTest.php line 13
What's up with that? All the docs call it statically.
I'm doing this on Symfony 2.0, if that makes a difference.
The documentation says you should be using the top-level Phactory class directly under lib/--not the individual implementations such as Phactory/Sql/Phactory which get instantiated based on the PDO object you pass to setConnection. Change
use Phactory\Sql\Phactory;
to
require_once 'Phactory/lib/Phactory.php';
The main class is in the global namespace and doesn't require a use statement.
https://github.com/chriskite/phactory/issues/30
From the code, setConnection, define and create are not static functions but the README and website guide do not reflect that.
e.g. test code
https://github.com/chriskite/phactory/blob/next/tests/Phactory/Sql/PhactoryTest.php
use Phactory\Sql\Phactory;
...
$this->pdo = new \PDO("sqlite:test.db");
$this->phactory = new Phactory($this->pdo);
$this->phactory->define('user');
$this->phactory->reset();
I don't know when it has been changed.
Too late anyways...
The current version, 0.3.2, is not backward compatible with the static method structure that is documented.
Here is the breaking commit: https://github.com/chriskite/phactory/commit/d3b60eeedea955ab7b5803ec29446d19888d3849
Unfortunately, the documentation has not been updated on http://phactory.org and the pearhub repo is no longer available.
I would look to the tests for examples: https://github.com/chriskite/phactory/blob/next/tests/Phactory/Sql/PhactoryTest.php

using common methods among multiple classes

I have a couple of class files in C#. I want to write a method that could be used in all the classes. For example, I am trying to write the method that returns the number of rows from the database table, and I need this in multiple times, so thought of writing a single method to share among all the classes. I thought it would be easy with the use of namespace. But when I add namespace in all the class files, it gives error stating "CONTROL NAME is not present in current context". From the internet search I came to the conclusion that I also need to add the namespace in xxx.designer.cs files. Is it correct? I tried to find the designer.cs files but could not, and in one of the solution it was stated that designer.cs file is created during compile time. If so how to add the namespace on designer.cs file.
Thank you!!!
You need to create a static class and this function that classes need to share has to be a static member.
This function can now be called from anywhere.
static class Helper
{
public static string Calculate(int myVariable)
{
//do some common calculation
}
//...
}
If these classes have common data members and you need to share a common function, you can consider using a base class. All common functionality and common data members would go into the base class, and by merit of inheriting that class, all your sub classes would be able to call this function.
Create a Static class and create static member functions into that. You need not to create instance of the class in this case and you can directly call member function using class name.

Resources